selinux\_getenforcemode(3) SELinux API documentation selinux\_getenforcemode(3)

# [NAME](#NAME)

selinux\_getenforcemode - get the enforcing state of SELinux

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;selinux/selinux.h&gt;**

**int selinux\_getenforcemode(int \*enforce);**

# [DESCRIPTION](#DESCRIPTION)

**selinux\_getenforcemode**() Reads the contents of the */etc/selinux/config* file to determine how the system was setup to run SELinux.

Sets the value of *enforce* to 1 if SELinux should be run in enforcing mode. Sets the value of *enforce* to 0 if SELinux should be run in permissive mode. Sets the value of *enforce* to -1 if SELinux should be disabled.

# [RETURN VALUE](#RETURN_VALUE)

On success, zero is returned. On failure, -1 is returned.

# [SEE ALSO](#SEE_ALSO)

[**selinux**(8)](/man/os/libselinux/selinux.8)

25 May 2004 dwalsh@redhat.com

---

Document: selinux_getenforcemode(3) from libselinux 3.11-r2 (Chainguard OS)
Source: https://github.com/SELinuxProject/selinux.git
