---
name: "seccomp_api_get"
section: "3"
platform: "linux"
package: "libseccomp"
version: "2.6.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/seccomp_api_get"
---

# seccomp\_api\_get(3)

Manage the libseccomp API level

## NAME

seccomp\_api\_get, seccomp\_api\_set - Manage the libseccomp API level

## SYNOPSIS

```
#include <seccomp.h>

const unsigned int seccomp_api_get(void);
int seccomp_api_set(unsigned int level);

Link with -lseccomp.
```

## DESCRIPTION

The **seccomp\_api\_get**() function returns an integer representing the functionality ("API level") provided by the current running kernel.  It is important to note that while **seccomp\_api\_get**() can be called multiple times, the kernel is only probed the first time to see what functionality is supported, all following calls to **seccomp\_api\_get**() return a cached value.

The **seccomp\_api\_set**() function allows callers to force the API level to the provided value; however, this is almost always a bad idea and use of this function is strongly discouraged.

The different API level values are described below:

- **0**

  Reserved value, not currently used.

- **1**

  Base level support.

- **2**

  The SCMP\_FLTATR\_CTL\_TSYNC filter attribute is supported and libseccomp uses the **[seccomp(2)](/seccomp/2.md)** syscall to load the seccomp filter into the kernel.

- **3**

  The SCMP\_FLTATR\_CTL\_LOG filter attribute and the SCMP\_ACT\_LOG action are supported.

- **4**

  The SCMP\_FLTATR\_CTL\_SSB filter attribute is supported.

- **5**

  The SCMP\_ACT\_NOTIFY action and the notify APIs are supported.

- **6**

  The simultaneous use of SCMP\_FLTATR\_CTL\_TSYNC and the notify APIs are supported.

- **7**

  The SCMP\_FLTATR\_CTL\_WAITKILL filter attribute is supported.

## RETURN VALUE

The **seccomp\_api\_get**() function returns an integer representing the supported API level.  The **seccomp\_api\_set**() function returns zero on success, negative values on failure.

## EXAMPLES

```
#include <seccomp.h>
int main(int argc, char *argv[])
{
	unsigned int api;
	api = seccomp_api_get();
	switch (api) {
	case 2:
		/* ... */
	default:
		/* ... */
	}
	return 0;
err:
	return 1;
}
```

## NOTES

While the seccomp filter can be generated independent of the kernel, kernel support is required to load and enforce the seccomp filter generated by libseccomp.

The libseccomp project site, with more information and the source code repository, can be found at https://github.com/seccomp/libseccomp.  This tool, as well as the libseccomp library, is currently under development, please report any bugs at the project site or directly to the author.

## AUTHOR

Paul Moore \<paul@paul-moore.com\>
