1 .TH "seccomp_arch_add" 3 "7 May 2014" "paul@paul-moore.com" "libseccomp Documentation"
2 .\" //////////////////////////////////////////////////////////////////////////
4 .\" //////////////////////////////////////////////////////////////////////////
5 seccomp_arch_add, seccomp_arch_remove, seccomp_arch_exist, seccomp_arch_native \- Manage seccomp filter architectures
6 .\" //////////////////////////////////////////////////////////////////////////
8 .\" //////////////////////////////////////////////////////////////////////////
10 .B #include <seccomp.h>
12 .B typedef void * scmp_filter_ctx;
14 .B #define SCMP_ARCH_NATIVE
15 .B #define SCMP_ARCH_X86
16 .B #define SCMP_ARCH_X86_64
18 .BI "uint32_t seccomp_arch_resolve_name(const char *" arch_name ");"
19 .BI "uint32_t seccomp_arch_native();"
20 .BI "int seccomp_arch_exist(const scmp_filter_ctx " ctx ", uint32_t " arch_token ");"
21 .BI "int seccomp_arch_add(scmp_filter_ctx " ctx ", uint32_t " arch_token ");"
22 .BI "int seccomp_arch_remove(scmp_filter_ctx " ctx ", uint32_t " arch_token ");"
24 Link with \fI\-lseccomp\fP.
26 .\" //////////////////////////////////////////////////////////////////////////
28 .\" //////////////////////////////////////////////////////////////////////////
31 .BR seccomp_arch_exist ()
32 function tests to see if a given architecture has been added to the seccomp
36 .BR seccomp_arch_add ()
38 .BR seccomp_arch_remove ()
39 add and remove, respectively, architectures from the seccomp filter. In all
40 three functions, the architecture values given in
44 defined constants; with the
46 constant always referring to the native compiled architecture. The
47 .BR seccomp_arch_native ()
48 function returns the system's architecture such that it will match one of the
51 .BR seccomp_arch_resolve_name ()
52 function also returns a
54 constant, the returned token matches the name of the architecture
55 passed as an argument to the function.
57 When a seccomp filter is initialized with the call to
59 the native architecture is automatically added to the filter.
61 While it is possible to remove all architectures from a filter, most of the
62 libseccomp APIs will fail if the filter does not contain at least one
65 When adding a new architecture to an existing filter, the existing rules will
66 not be added to the new architecture. However, rules added after adding the
67 new architecture will be added to all of the architectures in the filter.
68 .\" //////////////////////////////////////////////////////////////////////////
70 .\" //////////////////////////////////////////////////////////////////////////
72 .BR seccomp_arch_add ()
74 .BR seccomp_arch_remove ()
75 functions return zero on success, negative errno values on failure. The
76 .BR seccomp_arch_exist ()
77 function returns zero if the architecture exists, \-EEXIST if it does not, and
78 other negative errno values on failure.
79 .\" //////////////////////////////////////////////////////////////////////////
81 .\" //////////////////////////////////////////////////////////////////////////
85 int main(int argc, char *argv[])
90 ctx = seccomp_init(SCMP_ACT_KILL);
94 if (seccomp_arch_exist(ctx, SCMP_ARCH_X86) == \-EEXIST) {
95 rc = seccomp_arch_add(ctx, SCMP_ARCH_X86);
98 rc = seccomp_arch_remove(ctx, SCMP_ARCH_NATIVE);
106 seccomp_release(ctx);
110 .\" //////////////////////////////////////////////////////////////////////////
112 .\" //////////////////////////////////////////////////////////////////////////
114 While the seccomp filter can be generated independent of the kernel, kernel
115 support is required to load and enforce the seccomp filter generated by
118 The libseccomp project site, with more information and the source code
119 repository, can be found at https://github.com/seccomp/libseccomp. This tool,
120 as well as the libseccomp library, is currently under development, please
121 report any bugs at the project site or directly to the author.
122 .\" //////////////////////////////////////////////////////////////////////////
124 .\" //////////////////////////////////////////////////////////////////////////
125 Paul Moore <paul@paul-moore.com>
126 .\" //////////////////////////////////////////////////////////////////////////
128 .\" //////////////////////////////////////////////////////////////////////////
129 .BR seccomp_init (3),
130 .BR seccomp_reset (3),