---
name: "selinux_getenforcemode"
section: "3"
platform: "linux"
package: "libselinux1-dev"
version: "3.8.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/selinux_getenforcemode"
---

# selinux\_getenforcemode(3)

get the enforcing state of SELinux

## NAME

selinux\_getenforcemode - get the enforcing state of SELinux

## SYNOPSIS

**#include \<selinux/selinux.h\>**

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

## 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

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

## SEE ALSO

[**selinux**(8)](/selinux/8.md)
