1 .TH "seccomp_merge" 3 "28 September 2012" "paul@paul-moore.com" "libseccomp Documentation"
2 .\" //////////////////////////////////////////////////////////////////////////
4 .\" //////////////////////////////////////////////////////////////////////////
5 seccomp_merge \- Merge two seccomp filters
6 .\" //////////////////////////////////////////////////////////////////////////
8 .\" //////////////////////////////////////////////////////////////////////////
10 .B #include <seccomp.h>
12 .B typedef void * scmp_filter_ctx;
14 .BI "int seccomp_merge(scmp_filter_ctx " dst ", scmp_filter_ctx " src ");"
16 Link with \fI\-lseccomp\fP.
18 .\" //////////////////////////////////////////////////////////////////////////
20 .\" //////////////////////////////////////////////////////////////////////////
24 function merges the seccomp filter in
28 and stores the resulting in the
30 filter. If successfull, the
32 seccomp filter is released and all internal memory assocated with the filter
33 is freed; there is no need to call
34 .BR seccomp_release (3)
37 and the caller should discard any references to the filter.
39 In order to merge two seccomp filters, both filters must have the same
40 attribute values and no overlapping architectures.
41 .\" //////////////////////////////////////////////////////////////////////////
43 .\" //////////////////////////////////////////////////////////////////////////
44 Returns zero on success and negative values on failure.
45 .\" //////////////////////////////////////////////////////////////////////////
47 .\" //////////////////////////////////////////////////////////////////////////
51 int main(int argc, char *argv[])
54 scmp_filter_ctx ctx_32, ctx_64;
56 ctx_32 = seccomp_init(SCMP_ACT_KILL);
59 ctx_64 = seccomp_init(SCMP_ACT_KILL);
63 if (seccomp_arch_exist(ctx_32, SCMP_ARCH_X86) == \-EEXIST) {
64 rc = seccomp_arch_add(ctx_32, SCMP_ARCH_X86);
67 rc = seccomp_arch_remove(ctx_32, SCMP_ARCH_NATIVE);
71 if (seccomp_arch_exist(ctx_64, SCMP_ARCH_X86_64) == \-EEXIST) {
72 rc = seccomp_arch_add(ctx_64, SCMP_ARCH_X86_64);
75 rc = seccomp_arch_remove(ctx_64, SCMP_ARCH_NATIVE);
82 rc = seccomp_merge(ctx_64, ctx_32);
86 /* NOTE: the 'ctx_32' filter is no longer valid at this point */
91 seccomp_release(ctx_64);
94 seccomp_release(ctx_32);
98 .\" //////////////////////////////////////////////////////////////////////////
100 .\" //////////////////////////////////////////////////////////////////////////
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
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 .\" //////////////////////////////////////////////////////////////////////////
112 .\" //////////////////////////////////////////////////////////////////////////
113 Paul Moore <paul@paul-moore.com>
114 .\" //////////////////////////////////////////////////////////////////////////
116 .\" //////////////////////////////////////////////////////////////////////////
117 .BR seccomp_init (3),
118 .BR seccomp_reset (3),
119 .BR seccomp_arch_add (3),
120 .BR seccomp_arch_remove (3),
121 .BR seccomp_attr_get (3),
122 .BR seccomp_attr_set (3)