Skip to content

Commit c345f40

Browse files
committed
Move all seccomp consts and structs into top-level mod
Seccomp constants and structs were partially defined in the top-level mod.rs for linux and partially outside. This commit moves everything into the top-level mod and adds missing entries as of linux 6.4.12.
1 parent 8356615 commit c345f40

File tree

7 files changed

+58
-49
lines changed

7 files changed

+58
-49
lines changed

libc-test/semver/linux.txt

+16-2
Original file line numberDiff line numberDiff line change
@@ -2317,23 +2317,33 @@ SCTP_STATUS
23172317
SCTP_STREAM_RESET_INCOMING
23182318
SCTP_STREAM_RESET_OUTGOING
23192319
SCTP_UNORDERED
2320+
SECCOMP_ADDFD_FLAG_SEND
2321+
SECCOMP_ADDFD_FLAG_SETFD
23202322
SECCOMP_FILTER_FLAG_LOG
2323+
SECCOMP_FILTER_FLAG_NEW_LISTENER
23212324
SECCOMP_FILTER_FLAG_SPEC_ALLOW
23222325
SECCOMP_FILTER_FLAG_TSYNC
2326+
SECCOMP_FILTER_FLAG_TSYNC_ESRCH
2327+
SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV
2328+
SECCOMP_GET_ACTION_AVAIL
2329+
SECCOMP_GET_NOTIF_SIZES
23232330
SECCOMP_MODE_DISABLED
2324-
SECCOMP_MODE_FILTER
23252331
SECCOMP_MODE_STRICT
2332+
SECCOMP_MODE_FILTER
23262333
SECCOMP_RET_ACTION
23272334
SECCOMP_RET_ACTION_FULL
23282335
SECCOMP_RET_ALLOW
23292336
SECCOMP_RET_DATA
23302337
SECCOMP_RET_ERRNO
2331-
SECCOMP_RET_KILL
23322338
SECCOMP_RET_KILL_PROCESS
23332339
SECCOMP_RET_KILL_THREAD
2340+
SECCOMP_RET_KILL
23342341
SECCOMP_RET_LOG
23352342
SECCOMP_RET_TRACE
23362343
SECCOMP_RET_TRAP
2344+
SECCOMP_SET_MODE_FILTER
2345+
SECCOMP_SET_MODE_STRICT
2346+
SECCOMP_USER_NOTIF_FLAG_CONTINUE
23372347
SEEK_DATA
23382348
SEEK_HOLE
23392349
SELFMAG
@@ -3413,6 +3423,10 @@ sched_setparam
34133423
sched_setscheduler
34143424
sctp_assoc_t
34153425
seccomp_data
3426+
seccomp_notif
3427+
seccomp_notif_addfd
3428+
seccomp_notif_resp
3429+
seccomp_notif_sizes
34163430
seed48
34173431
seekdir
34183432
sem_close

src/unix/linux_like/linux/gnu/b32/arm/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ s! {
162162
pub ss_size: ::size_t
163163
}
164164

165-
pub struct seccomp_notif_sizes {
166-
pub seccomp_notif: ::__u16,
167-
pub seccomp_notif_resp: ::__u16,
168-
pub seccomp_data: ::__u16,
169-
}
170-
171165
pub struct mcontext_t {
172166
pub trap_no: ::c_ulong,
173167
pub error_code: ::c_ulong,
@@ -465,11 +459,6 @@ pub const B3000000: ::speed_t = 0o010015;
465459
pub const B3500000: ::speed_t = 0o010016;
466460
pub const B4000000: ::speed_t = 0o010017;
467461

468-
pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
469-
pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
470-
pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
471-
pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
472-
473462
pub const VEOL: usize = 11;
474463
pub const VEOL2: usize = 16;
475464
pub const VMIN: usize = 6;

src/unix/linux_like/linux/gnu/b32/csky/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,6 @@ pub const B3000000: ::speed_t = 0o010015;
414414
pub const B3500000: ::speed_t = 0o010016;
415415
pub const B4000000: ::speed_t = 0o010017;
416416

417-
pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
418-
pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
419-
pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
420-
pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
421-
422417
pub const VEOL: usize = 11;
423418
pub const VEOL2: usize = 16;
424419
pub const VMIN: usize = 6;

src/unix/linux_like/linux/gnu/b32/x86/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,6 @@ s! {
236236
pub ss_size: ::size_t
237237
}
238238

239-
pub struct seccomp_notif_sizes {
240-
pub seccomp_notif: ::__u16,
241-
pub seccomp_notif_resp: ::__u16,
242-
pub seccomp_data: ::__u16,
243-
}
244239
}
245240

246241
s_no_extra_traits! {
@@ -1089,11 +1084,6 @@ pub const REG_EFL: ::c_int = 16;
10891084
pub const REG_UESP: ::c_int = 17;
10901085
pub const REG_SS: ::c_int = 18;
10911086

1092-
pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
1093-
pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
1094-
pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
1095-
pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
1096-
10971087
extern "C" {
10981088
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
10991089
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;

src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ s! {
197197
pub ss_size: ::size_t
198198
}
199199

200-
pub struct seccomp_notif_sizes {
201-
pub seccomp_notif: ::__u16,
202-
pub seccomp_notif_resp: ::__u16,
203-
pub seccomp_data: ::__u16,
204-
}
205200
}
206201

207202
pub const VEOF: usize = 4;
@@ -512,11 +507,6 @@ pub const B3000000: ::speed_t = 0o010015;
512507
pub const B3500000: ::speed_t = 0o010016;
513508
pub const B4000000: ::speed_t = 0o010017;
514509

515-
pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
516-
pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
517-
pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
518-
pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
519-
520510
pub const VEOL: usize = 11;
521511
pub const VEOL2: usize = 16;
522512
pub const VMIN: usize = 6;

src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,6 @@ s! {
260260
__unused5: u64
261261
}
262262

263-
pub struct seccomp_notif_sizes {
264-
pub seccomp_notif: ::__u16,
265-
pub seccomp_notif_resp: ::__u16,
266-
pub seccomp_data: ::__u16,
267-
}
268-
269263
pub struct ptrace_rseq_configuration {
270264
pub rseq_abi_pointer: ::__u64,
271265
pub rseq_abi_size: ::__u32,
@@ -802,11 +796,6 @@ pub const REG_TRAPNO: ::c_int = 20;
802796
pub const REG_OLDMASK: ::c_int = 21;
803797
pub const REG_CR2: ::c_int = 22;
804798

805-
pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
806-
pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
807-
pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
808-
pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
809-
810799
extern "C" {
811800
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
812801
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;

src/unix/linux_like/linux/mod.rs

+42
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,34 @@ s! {
577577
pub args: [::__u64; 6],
578578
}
579579

580+
pub struct seccomp_notif_sizes {
581+
pub seccomp_notif: ::__u16,
582+
pub seccomp_notif_resp: ::__u16,
583+
pub seccomp_data: ::__u16,
584+
}
585+
586+
pub struct seccomp_notif {
587+
pub id: ::__u64,
588+
pub pid: ::__u32,
589+
pub flags: ::__u32,
590+
pub data: seccomp_data,
591+
}
592+
593+
pub struct seccomp_notif_resp {
594+
pub id: ::__u64,
595+
pub val: ::__s64,
596+
pub error: ::__s32,
597+
pub flags: ::__u32,
598+
}
599+
600+
pub struct seccomp_notif_addfd {
601+
pub id: ::__u64,
602+
pub flags: ::__u32,
603+
pub srcfd: ::__u32,
604+
pub newfd: ::__u32,
605+
pub newfd_flags: ::__u32,
606+
}
607+
580608
pub struct nlmsghdr {
581609
pub nlmsg_len: u32,
582610
pub nlmsg_type: u16,
@@ -2187,13 +2215,22 @@ pub const GRND_NONBLOCK: ::c_uint = 0x0001;
21872215
pub const GRND_RANDOM: ::c_uint = 0x0002;
21882216
pub const GRND_INSECURE: ::c_uint = 0x0004;
21892217

2218+
// <linux/seccomp.h>
21902219
pub const SECCOMP_MODE_DISABLED: ::c_uint = 0;
21912220
pub const SECCOMP_MODE_STRICT: ::c_uint = 1;
21922221
pub const SECCOMP_MODE_FILTER: ::c_uint = 2;
21932222

2223+
pub const SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
2224+
pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
2225+
pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
2226+
pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
2227+
21942228
pub const SECCOMP_FILTER_FLAG_TSYNC: ::c_ulong = 1;
21952229
pub const SECCOMP_FILTER_FLAG_LOG: ::c_ulong = 2;
21962230
pub const SECCOMP_FILTER_FLAG_SPEC_ALLOW: ::c_ulong = 4;
2231+
pub const SECCOMP_FILTER_FLAG_NEW_LISTENER: ::c_ulong = 8;
2232+
pub const SECCOMP_FILTER_FLAG_TSYNC_ESRCH: ::c_ulong = 16;
2233+
pub const SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV: ::c_ulong = 32;
21972234

21982235
pub const SECCOMP_RET_KILL_PROCESS: ::c_uint = 0x80000000;
21992236
pub const SECCOMP_RET_KILL_THREAD: ::c_uint = 0x00000000;
@@ -2208,6 +2245,11 @@ pub const SECCOMP_RET_ACTION_FULL: ::c_uint = 0xffff0000;
22082245
pub const SECCOMP_RET_ACTION: ::c_uint = 0x7fff0000;
22092246
pub const SECCOMP_RET_DATA: ::c_uint = 0x0000ffff;
22102247

2248+
pub const SECCOMP_USER_NOTIF_FLAG_CONTINUE: ::c_ulong = 1;
2249+
2250+
pub const SECCOMP_ADDFD_FLAG_SETFD: ::c_ulong = 1;
2251+
pub const SECCOMP_ADDFD_FLAG_SEND: ::c_ulong = 2;
2252+
22112253
pub const ITIMER_REAL: ::c_int = 0;
22122254
pub const ITIMER_VIRTUAL: ::c_int = 1;
22132255
pub const ITIMER_PROF: ::c_int = 2;

0 commit comments

Comments
 (0)