1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/* automatically generated by rust-bindgen */

pub const SCMP_VER_MAJOR: u32 = 2;
pub const SCMP_VER_MINOR: u32 = 5;
pub const SCMP_VER_MICRO: u32 = 1;
pub const SCMP_ARCH_NATIVE: u32 = 0;
pub const SCMP_ARCH_X86: u32 = 1073741827;
pub const SCMP_ARCH_X86_64: u32 = 3221225534;
pub const SCMP_ARCH_X32: u32 = 1073741886;
pub const SCMP_ARCH_ARM: u32 = 1073741864;
pub const SCMP_ARCH_AARCH64: u32 = 3221225655;
pub const SCMP_ARCH_MIPS: u32 = 8;
pub const SCMP_ARCH_MIPS64: u32 = 2147483656;
pub const SCMP_ARCH_MIPS64N32: u32 = 2684354568;
pub const SCMP_ARCH_MIPSEL: u32 = 1073741832;
pub const SCMP_ARCH_MIPSEL64: u32 = 3221225480;
pub const SCMP_ARCH_MIPSEL64N32: u32 = 3758096392;
pub const SCMP_ARCH_PPC: u32 = 20;
pub const SCMP_ARCH_PPC64: u32 = 2147483669;
pub const SCMP_ARCH_PPC64LE: u32 = 3221225493;
pub const SCMP_ARCH_S390: u32 = 22;
pub const SCMP_ARCH_S390X: u32 = 2147483670;
pub const SCMP_ARCH_PARISC: u32 = 15;
pub const SCMP_ARCH_PARISC64: u32 = 2147483663;
pub const SCMP_ARCH_RISCV64: u32 = 3221225715;
pub const SCMP_ACT_KILL_PROCESS: u32 = 2147483648;
pub const SCMP_ACT_KILL_THREAD: u32 = 0;
pub const SCMP_ACT_KILL: u32 = 0;
pub const SCMP_ACT_TRAP: u32 = 196608;
pub const SCMP_ACT_NOTIFY: u32 = 2143289344;
pub const SCMP_ACT_LOG: u32 = 2147221504;
pub const SCMP_ACT_ALLOW: u32 = 2147418112;
pub const __NR_SCMP_ERROR: i32 = -1;
pub const __NR_SCMP_UNDEF: i32 = -2;
pub type __uint8_t = ::std::os::raw::c_uchar;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __uint64_t = ::std::os::raw::c_ulong;
pub type __u16 = ::std::os::raw::c_ushort;
pub type __s32 = ::std::os::raw::c_int;
pub type __u32 = ::std::os::raw::c_uint;
pub type __s64 = ::std::os::raw::c_longlong;
pub type __u64 = ::std::os::raw::c_ulonglong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct seccomp_data {
    pub nr: ::std::os::raw::c_int,
    pub arch: __u32,
    pub instruction_pointer: __u64,
    pub args: [__u64; 6usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct seccomp_notif_sizes {
    pub seccomp_notif: __u16,
    pub seccomp_notif_resp: __u16,
    pub seccomp_data: __u16,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct seccomp_notif {
    pub id: __u64,
    pub pid: __u32,
    pub flags: __u32,
    pub data: seccomp_data,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct seccomp_notif_resp {
    pub id: __u64,
    pub val: __s64,
    pub error: __s32,
    pub flags: __u32,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct scmp_version {
    pub major: ::std::os::raw::c_uint,
    pub minor: ::std::os::raw::c_uint,
    pub micro: ::std::os::raw::c_uint,
}
pub type scmp_filter_ctx = *mut ::std::os::raw::c_void;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum scmp_filter_attr {
    _SCMP_FLTATR_MIN = 0,
    SCMP_FLTATR_ACT_DEFAULT = 1,
    SCMP_FLTATR_ACT_BADARCH = 2,
    SCMP_FLTATR_CTL_NNP = 3,
    SCMP_FLTATR_CTL_TSYNC = 4,
    SCMP_FLTATR_API_TSKIP = 5,
    SCMP_FLTATR_CTL_LOG = 6,
    SCMP_FLTATR_CTL_SSB = 7,
    SCMP_FLTATR_CTL_OPTIMIZE = 8,
    SCMP_FLTATR_API_SYSRAWRC = 9,
    _SCMP_FLTATR_MAX = 10,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum scmp_compare {
    _SCMP_CMP_MIN = 0,
    SCMP_CMP_NE = 1,
    SCMP_CMP_LT = 2,
    SCMP_CMP_LE = 3,
    SCMP_CMP_EQ = 4,
    SCMP_CMP_GE = 5,
    SCMP_CMP_GT = 6,
    SCMP_CMP_MASKED_EQ = 7,
    _SCMP_CMP_MAX = 8,
}
pub type scmp_datum_t = u64;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct scmp_arg_cmp {
    pub arg: ::std::os::raw::c_uint,
    pub op: scmp_compare,
    pub datum_a: scmp_datum_t,
    pub datum_b: scmp_datum_t,
}
extern "C" {
    pub fn seccomp_version() -> *const scmp_version;
}
extern "C" {
    pub fn seccomp_api_get() -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn seccomp_api_set(level: ::std::os::raw::c_uint) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_init(def_action: u32) -> scmp_filter_ctx;
}
extern "C" {
    pub fn seccomp_reset(ctx: scmp_filter_ctx, def_action: u32) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_release(ctx: scmp_filter_ctx);
}
extern "C" {
    pub fn seccomp_merge(
        ctx_dst: scmp_filter_ctx,
        ctx_src: scmp_filter_ctx,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_arch_resolve_name(arch_name: *const ::std::os::raw::c_char) -> u32;
}
extern "C" {
    pub fn seccomp_arch_native() -> u32;
}
extern "C" {
    pub fn seccomp_arch_exist(ctx: scmp_filter_ctx, arch_token: u32) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_arch_add(ctx: scmp_filter_ctx, arch_token: u32) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_arch_remove(ctx: scmp_filter_ctx, arch_token: u32) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_load(ctx: scmp_filter_ctx) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_attr_get(
        ctx: scmp_filter_ctx,
        attr: scmp_filter_attr,
        value: *mut u32,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_attr_set(
        ctx: scmp_filter_ctx,
        attr: scmp_filter_attr,
        value: u32,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_syscall_resolve_num_arch(
        arch_token: u32,
        num: ::std::os::raw::c_int,
    ) -> *mut ::std::os::raw::c_char;
}
extern "C" {
    pub fn seccomp_syscall_resolve_name_arch(
        arch_token: u32,
        name: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_syscall_resolve_name_rewrite(
        arch_token: u32,
        name: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_syscall_resolve_name(
        name: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_syscall_priority(
        ctx: scmp_filter_ctx,
        syscall: ::std::os::raw::c_int,
        priority: u8,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_rule_add(
        ctx: scmp_filter_ctx,
        action: u32,
        syscall: ::std::os::raw::c_int,
        arg_cnt: ::std::os::raw::c_uint,
        ...
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_rule_add_array(
        ctx: scmp_filter_ctx,
        action: u32,
        syscall: ::std::os::raw::c_int,
        arg_cnt: ::std::os::raw::c_uint,
        arg_array: *const scmp_arg_cmp,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_rule_add_exact(
        ctx: scmp_filter_ctx,
        action: u32,
        syscall: ::std::os::raw::c_int,
        arg_cnt: ::std::os::raw::c_uint,
        ...
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_rule_add_exact_array(
        ctx: scmp_filter_ctx,
        action: u32,
        syscall: ::std::os::raw::c_int,
        arg_cnt: ::std::os::raw::c_uint,
        arg_array: *const scmp_arg_cmp,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_notify_alloc(
        req: *mut *mut seccomp_notif,
        resp: *mut *mut seccomp_notif_resp,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_notify_free(req: *mut seccomp_notif, resp: *mut seccomp_notif_resp);
}
extern "C" {
    pub fn seccomp_notify_receive(
        fd: ::std::os::raw::c_int,
        req: *mut seccomp_notif,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_notify_respond(
        fd: ::std::os::raw::c_int,
        resp: *mut seccomp_notif_resp,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_notify_id_valid(fd: ::std::os::raw::c_int, id: u64) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_notify_fd(ctx: scmp_filter_ctx) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_export_pfc(
        ctx: scmp_filter_ctx,
        fd: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn seccomp_export_bpf(
        ctx: scmp_filter_ctx,
        fd: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}