1seccomp_api_get(3)         libseccomp Documentation         seccomp_api_get(3)
2
3
4

NAME

6       seccomp_api_get, seccomp_api_set - Manage the libseccomp API level
7

SYNOPSIS

9       #include <seccomp.h>
10
11       const unsigned int seccomp_api_get(void);
12       int seccomp_api_set(unsigned int level);
13
14       Link with -lseccomp.
15

DESCRIPTION

17       The  seccomp_api_get()  function  returns  an  integer representing the
18       functionality ("API level") provided by the current running kernel.  It
19       is  important to note that while seccomp_api_get() can be called multi‐
20       ple times, the kernel is only probed the first time to see  what  func‐
21       tionality is supported, all following calls to seccomp_api_get() return
22       a cached value.
23
24       The seccomp_api_set() function allows callers to force the API level to
25       the  provided  value; however, this is almost always a bad idea and use
26       of this function is strongly discouraged.
27
28       The different API level values are described below:
29
30       0      Reserved value, not currently used.
31
32       1      Base level support.
33
34       2      The SCMP_FLTATR_CTL_TSYNC filter attribute is supported and lib‐
35              seccomp  uses  the seccomp(2) syscall to load the seccomp filter
36              into the kernel.
37
38       3      The SCMP_FLTATR_CTL_LOG filter attribute  and  the  SCMP_ACT_LOG
39              action are supported.
40

RETURN VALUE

42       The seccomp_api_get() function returns an integer representing the sup‐
43       ported API level.  The seccomp_api_set() function returns zero on  suc‐
44       cess, negative values on failure.
45

EXAMPLES

47       #include <seccomp.h>
48
49       int main(int argc, char *argv[])
50       {
51            unsigned int api;
52
53            api = seccomp_api_get();
54            switch (api) {
55            case 2:
56                 /* ... */
57            default:
58                 /* ... */
59            }
60
61            return 0;
62
63       err:
64            return -1;
65       }
66

NOTES

68       While  the  seccomp  filter can be generated independent of the kernel,
69       kernel support is required to load and enforce the seccomp filter  gen‐
70       erated by libseccomp.
71
72       The  libseccomp project site, with more information and the source code
73       repository,  can  be  found  at  https://github.com/seccomp/libseccomp.
74       This tool, as well as the libseccomp library, is currently under devel‐
75       opment, please report any bugs at the project site or directly  to  the
76       author.
77

AUTHOR

79       Paul Moore <paul@paul-moore.com>
80
81
82
83paul@paul-moore.com             8 October 2017              seccomp_api_get(3)
Impressum