Debian Codegraph @

doc/man/man3/seccomp_api_get.3

raw
1 .TH "seccomp_api_get" 3 "22 September 2022" "[email protected]" "libseccomp Documentation"
2 .\" //////////////////////////////////////////////////////////////////////////
3 .SH NAME
4 .\" //////////////////////////////////////////////////////////////////////////
5 seccomp_api_get, seccomp_api_set \- Manage the libseccomp API level
6 .\" //////////////////////////////////////////////////////////////////////////
7 .SH SYNOPSIS
8 .\" //////////////////////////////////////////////////////////////////////////
9 .nf
10 .B #include <seccomp.h>
11 .sp
12 .BI "const unsigned int seccomp_api_get(" void ");"
13 .BI "int seccomp_api_set(unsigned int " level ");"
14 .sp
15 Link with \fI\-lseccomp\fP.
16 .fi
17 .\" //////////////////////////////////////////////////////////////////////////
18 .SH DESCRIPTION
19 .\" //////////////////////////////////////////////////////////////////////////
20 .P
21 The
22 .BR seccomp_api_get ()
23 function returns an integer representing the functionality ("API level")
24 provided by the current running kernel. It is important to note that while
25 .BR seccomp_api_get ()
26 can be called multiple times, the kernel is only probed the first time to see
27 what functionality is supported, all following calls to
28 .BR seccomp_api_get ()
29 return a cached value.
30 .P
31 The
32 .BR seccomp_api_set ()
33 function allows callers to force the API level to the provided value; however,
34 this is almost always a bad idea and use of this function is strongly
35 discouraged.
36 .P
37 The different API level values are described below:
38 .TP
39 .B 0
40 Reserved value, not currently used.
41 .TP
42 .B 1
43 Base level support.
44 .TP
45 .B 2
46 The SCMP_FLTATR_CTL_TSYNC filter attribute is supported and libseccomp uses
47 the
48 .BR seccomp(2)
49 syscall to load the seccomp filter into the kernel.
50 .TP
51 .B 3
52 The SCMP_FLTATR_CTL_LOG filter attribute and the SCMP_ACT_LOG action are
53 supported.
54 .TP
55 .B 4
56 The SCMP_FLTATR_CTL_SSB filter attribute is supported.
57 .TP
58 .B 5
59 The SCMP_ACT_NOTIFY action and the notify APIs are supported.
60 .TP
61 .B 6
62 The simultaneous use of SCMP_FLTATR_CTL_TSYNC and the notify APIs are supported.
63 .TP
64 .B 7
65 The SCMP_FLTATR_CTL_WAITKILL filter attribute is supported.
66 .\" //////////////////////////////////////////////////////////////////////////
67 .SH RETURN VALUE
68 .\" //////////////////////////////////////////////////////////////////////////
69 The
70 .BR seccomp_api_get ()
71 function returns an integer representing the supported API level. The
72 .BR seccomp_api_set ()
73 function returns zero on success, negative values on failure.
74 .\" //////////////////////////////////////////////////////////////////////////
75 .SH EXAMPLES
76 .\" //////////////////////////////////////////////////////////////////////////
77 .nf
78 #include <seccomp.h>
79
80 int main(int argc, char *argv[])
81 {
82 unsigned int api;
83
84 api = seccomp_api_get();
85 switch (api) {
86 case 2:
87 /* ... */
88 default:
89 /* ... */
90 }
91
92 return 0;
93
94 err:
95 return 1;
96 }
97 .fi
98 .\" //////////////////////////////////////////////////////////////////////////
99 .SH NOTES
100 .\" //////////////////////////////////////////////////////////////////////////
101 .P
102 While the seccomp filter can be generated independent of the kernel, kernel
103 support is required to load and enforce the seccomp filter generated by
104 libseccomp.
105 .P
106 The libseccomp project site, with more information and the source code
107 repository, can be found at https://github.com/seccomp/libseccomp. This tool,
108 as well as the libseccomp library, is currently under development, please
109 report any bugs at the project site or directly to the author.
110 .\" //////////////////////////////////////////////////////////////////////////
111 .SH AUTHOR
112 .\" //////////////////////////////////////////////////////////////////////////
113 Paul Moore <[email protected]>
114 .\" //////////////////////////////////////////////////////////////////////////