std: update for linux 5.6 release
This commit is contained in:
committed by
Andrew Kelley
parent
de9933761c
commit
356ef3840f
@@ -88,11 +88,29 @@ pub const FUTEX_PRIVATE_FLAG = 128;
|
||||
|
||||
pub const FUTEX_CLOCK_REALTIME = 256;
|
||||
|
||||
pub const PROT_NONE = 0;
|
||||
pub const PROT_READ = 1;
|
||||
pub const PROT_WRITE = 2;
|
||||
pub const PROT_EXEC = 4;
|
||||
/// page can not be accessed
|
||||
pub const PROT_NONE = 0x0;
|
||||
|
||||
/// page can be read
|
||||
pub const PROT_READ = 0x1;
|
||||
|
||||
/// page can be written
|
||||
pub const PROT_WRITE = 0x2;
|
||||
|
||||
/// page can be executed
|
||||
pub const PROT_EXEC = 0x4;
|
||||
|
||||
/// page may be used for atomic ops
|
||||
pub const PROT_SEM = switch (builtin.arch) {
|
||||
// TODO: also xtensa
|
||||
.mips, .mipsel, .mips64, .mips64el => 0x10,
|
||||
else => 0x8,
|
||||
};
|
||||
|
||||
/// mprotect flag: extend change to start of growsdown vma
|
||||
pub const PROT_GROWSDOWN = 0x01000000;
|
||||
|
||||
/// mprotect flag: extend change to end of growsup vma
|
||||
pub const PROT_GROWSUP = 0x02000000;
|
||||
|
||||
/// Share changes
|
||||
@@ -617,6 +635,11 @@ pub const CLONE_IO = 0x80000000;
|
||||
/// Clear any signal handler and reset to SIG_DFL.
|
||||
pub const CLONE_CLEAR_SIGHAND = 0x100000000;
|
||||
|
||||
// cloning flags intersect with CSIGNAL so can be used with unshare and clone3 syscalls only.
|
||||
|
||||
/// New time namespace
|
||||
pub const CLONE_NEWTIME = 0x00000080;
|
||||
|
||||
pub const EFD_SEMAPHORE = 1;
|
||||
pub const EFD_CLOEXEC = O_CLOEXEC;
|
||||
pub const EFD_NONBLOCK = O_NONBLOCK;
|
||||
@@ -1125,7 +1148,8 @@ pub const io_uring_params = extern struct {
|
||||
sq_thread_cpu: u32,
|
||||
sq_thread_idle: u32,
|
||||
features: u32,
|
||||
resv: [4]u32,
|
||||
wq_fd: u32,
|
||||
resv: [3]u32,
|
||||
sq_off: io_sqring_offsets,
|
||||
cq_off: io_cqring_offsets,
|
||||
};
|
||||
@@ -1135,6 +1159,8 @@ pub const io_uring_params = extern struct {
|
||||
pub const IORING_FEAT_SINGLE_MMAP = 1 << 0;
|
||||
pub const IORING_FEAT_NODROP = 1 << 1;
|
||||
pub const IORING_FEAT_SUBMIT_STABLE = 1 << 2;
|
||||
pub const IORING_FEAT_RW_CUR_POS = 1 << 3;
|
||||
pub const IORING_FEAT_CUR_PERSONALITY = 1 << 4;
|
||||
|
||||
// io_uring_params.flags
|
||||
|
||||
@@ -1150,6 +1176,12 @@ pub const IORING_SETUP_SQ_AFF = 1 << 2;
|
||||
/// app defines CQ size
|
||||
pub const IORING_SETUP_CQSIZE = 1 << 3;
|
||||
|
||||
/// clamp SQ/CQ ring sizes
|
||||
pub const IORING_SETUP_CLAMP = 1 << 4;
|
||||
|
||||
/// attach to existing wq
|
||||
pub const IORING_SETUP_ATTACH_WQ = 1 << 5;
|
||||
|
||||
pub const io_sqring_offsets = extern struct {
|
||||
/// offset of ring head
|
||||
head: u32,
|
||||
@@ -1192,7 +1224,7 @@ pub const io_cqring_offsets = extern struct {
|
||||
};
|
||||
|
||||
pub const io_uring_sqe = extern struct {
|
||||
opcode: u8,
|
||||
opcode: IORING_OP,
|
||||
flags: u8,
|
||||
ioprio: u16,
|
||||
fd: i32,
|
||||
@@ -1212,31 +1244,53 @@ pub const io_uring_sqe = extern struct {
|
||||
timeout_flags: u32,
|
||||
accept_flags: u32,
|
||||
cancel_flags: u32,
|
||||
open_flags: u32,
|
||||
statx_flags: u32,
|
||||
fadvise_flags: u32,
|
||||
};
|
||||
union2: union2,
|
||||
user_data: u64,
|
||||
pub const union3 = extern union {
|
||||
buf_index: u16,
|
||||
struct1: extern struct {
|
||||
/// index into fixed buffers, if used
|
||||
buf_index: u16,
|
||||
|
||||
/// personality to use, if used
|
||||
personality: u16,
|
||||
},
|
||||
__pad2: [3]u64,
|
||||
};
|
||||
union3: union3,
|
||||
};
|
||||
|
||||
pub const IOSQE_BIT = extern enum {
|
||||
FIXED_FILE,
|
||||
IO_DRAIN,
|
||||
IO_LINK,
|
||||
IO_HARDLINK,
|
||||
ASYNC,
|
||||
|
||||
_,
|
||||
};
|
||||
|
||||
// io_uring_sqe.flags
|
||||
|
||||
/// use fixed fileset
|
||||
pub const IOSQE_FIXED_FILE = 1 << 0;
|
||||
pub const IOSQE_FIXED_FILE = 1 << IOSQE_BIT.FIXED_FILE;
|
||||
|
||||
/// issue after inflight IO
|
||||
pub const IOSQE_IO_DRAIN = 1 << 1;
|
||||
pub const IOSQE_IO_DRAIN = 1 << IOSQE_BIT.IO_DRAIN;
|
||||
|
||||
/// links next sqe
|
||||
pub const IOSQE_IO_LINK = 1 << 2;
|
||||
pub const IOSQE_IO_LINK = 1 << IOSQE_BIT.IO_LINK;
|
||||
|
||||
/// like LINK, but stronger
|
||||
pub const IOSQE_IO_HARDLINK = 1 << 3;
|
||||
pub const IOSQE_IO_HARDLINK = 1 << IOSQE_BIT.IO_HARDLINK;
|
||||
|
||||
pub const IORING_OP = extern enum {
|
||||
/// always go async
|
||||
pub const IOSQE_ASYNC = 1 << IOSQE_BIT.ASYNC;
|
||||
|
||||
pub const IORING_OP = extern enum(u8) {
|
||||
NOP,
|
||||
READV,
|
||||
WRITEV,
|
||||
@@ -1254,6 +1308,19 @@ pub const IORING_OP = extern enum {
|
||||
ASYNC_CANCEL,
|
||||
LINK_TIMEOUT,
|
||||
CONNECT,
|
||||
FALLOCATE,
|
||||
OPENAT,
|
||||
CLOSE,
|
||||
FILES_UPDATE,
|
||||
STATX,
|
||||
READ,
|
||||
WRITE,
|
||||
FADVISE,
|
||||
MADVISE,
|
||||
SEND,
|
||||
RECV,
|
||||
OPENAT2,
|
||||
EPOLL_CTL,
|
||||
|
||||
_,
|
||||
};
|
||||
@@ -1283,13 +1350,21 @@ pub const IORING_ENTER_GETEVENTS = 1 << 0;
|
||||
pub const IORING_ENTER_SQ_WAKEUP = 1 << 1;
|
||||
|
||||
// io_uring_register opcodes and arguments
|
||||
pub const IORING_REGISTER_BUFFERS = 0;
|
||||
pub const IORING_UNREGISTER_BUFFERS = 1;
|
||||
pub const IORING_REGISTER_FILES = 2;
|
||||
pub const IORING_UNREGISTER_FILES = 3;
|
||||
pub const IORING_REGISTER_EVENTFD = 4;
|
||||
pub const IORING_UNREGISTER_EVENTFD = 5;
|
||||
pub const IORING_REGISTER_FILES_UPDATE = 6;
|
||||
pub const IORING_REGISTER = extern enum(u32) {
|
||||
REGISTER_BUFFERS,
|
||||
UNREGISTER_BUFFERS,
|
||||
REGISTER_FILES,
|
||||
UNREGISTER_FILES,
|
||||
REGISTER_EVENTFD,
|
||||
UNREGISTER_EVENTFD,
|
||||
REGISTER_FILES_UPDATE,
|
||||
REGISTER_EVENTFD_ASYNC,
|
||||
REGISTER_PROBE,
|
||||
REGISTER_PERSONALITY,
|
||||
UNREGISTER_PERSONALITY,
|
||||
|
||||
_,
|
||||
};
|
||||
|
||||
pub const io_uring_files_update = struct {
|
||||
offset: u32,
|
||||
@@ -1297,6 +1372,32 @@ pub const io_uring_files_update = struct {
|
||||
fds: u64,
|
||||
};
|
||||
|
||||
pub const IO_URING_OP_SUPPORTED = 1 << 0;
|
||||
|
||||
pub const io_uring_probe_op = struct {
|
||||
op: IORING_OP,
|
||||
|
||||
resv: u8,
|
||||
|
||||
/// IO_URING_OP_* flags
|
||||
flags: u16,
|
||||
|
||||
resv2: u32,
|
||||
};
|
||||
|
||||
pub const io_uring_probe = struct {
|
||||
/// last opcode supported
|
||||
last_op: IORING_OP,
|
||||
|
||||
/// Number of io_uring_probe_op following
|
||||
ops_len: u8,
|
||||
|
||||
resv: u16,
|
||||
resv2: u32[3],
|
||||
|
||||
// Followed by up to `ops_len` io_uring_probe_op structures
|
||||
};
|
||||
|
||||
pub const utsname = extern struct {
|
||||
sysname: [64:0]u8,
|
||||
nodename: [64:0]u8,
|
||||
|
||||
@@ -400,6 +400,8 @@ pub const SYS_fsmount = 432;
|
||||
pub const SYS_fspick = 433;
|
||||
pub const SYS_pidfd_open = 434;
|
||||
pub const SYS_clone3 = 435;
|
||||
pub const SYS_openat2 = 437;
|
||||
pub const SYS_pidfd_getfd = 438;
|
||||
|
||||
pub const SYS_breakpoint = 0x0f0001;
|
||||
pub const SYS_cacheflush = 0x0f0002;
|
||||
|
||||
@@ -302,6 +302,8 @@ pub const SYS_fsmount = 432;
|
||||
pub const SYS_fspick = 433;
|
||||
pub const SYS_pidfd_open = 434;
|
||||
pub const SYS_clone3 = 435;
|
||||
pub const SYS_openat2 = 437;
|
||||
pub const SYS_pidfd_getfd = 438;
|
||||
|
||||
pub const O_CREAT = 0o100;
|
||||
pub const O_EXCL = 0o200;
|
||||
|
||||
@@ -434,6 +434,8 @@ pub const SYS_fsopen = 430;
|
||||
pub const SYS_fsconfig = 431;
|
||||
pub const SYS_fsmount = 432;
|
||||
pub const SYS_fspick = 433;
|
||||
pub const SYS_openat2 = 437;
|
||||
pub const SYS_pidfd_getfd = 438;
|
||||
|
||||
pub const O_CREAT = 0o100;
|
||||
pub const O_EXCL = 0o200;
|
||||
|
||||
@@ -375,6 +375,8 @@ pub const SYS_pkey_free = (SYS_Linux + 365);
|
||||
pub const SYS_statx = (SYS_Linux + 366);
|
||||
pub const SYS_rseq = (SYS_Linux + 367);
|
||||
pub const SYS_io_pgetevents = (SYS_Linux + 368);
|
||||
pub const SYS_openat2 = (SYS_Linux + 437);
|
||||
pub const SYS_pidfd_getfd = (SYS_Linux + 438);
|
||||
|
||||
pub const O_CREAT = 0o0400;
|
||||
pub const O_EXCL = 0o02000;
|
||||
|
||||
@@ -297,6 +297,8 @@ pub const SYS_fsmount = 432;
|
||||
pub const SYS_fspick = 433;
|
||||
pub const SYS_pidfd_open = 434;
|
||||
pub const SYS_clone3 = 435;
|
||||
pub const SYS_openat2 = 437;
|
||||
pub const SYS_pidfd_getfd = 438;
|
||||
|
||||
pub const O_CREAT = 0o100;
|
||||
pub const O_EXCL = 0o200;
|
||||
|
||||
@@ -362,6 +362,8 @@ pub const SYS_fsmount = 432;
|
||||
pub const SYS_fspick = 433;
|
||||
pub const SYS_pidfd_open = 434;
|
||||
pub const SYS_clone3 = 435;
|
||||
pub const SYS_openat2 = 437;
|
||||
pub const SYS_pidfd_getfd = 438;
|
||||
|
||||
pub const O_CREAT = 0o100;
|
||||
pub const O_EXCL = 0o200;
|
||||
|
||||
@@ -1169,8 +1169,8 @@ pub fn io_uring_enter(fd: i32, to_submit: u32, min_complete: u32, flags: u32, si
|
||||
return syscall6(SYS_io_uring_enter, @bitCast(usize, @as(isize, fd)), to_submit, min_complete, flags, @ptrToInt(sig), NSIG / 8);
|
||||
}
|
||||
|
||||
pub fn io_uring_register(fd: i32, opcode: u32, arg: ?*const c_void, nr_args: u32) usize {
|
||||
return syscall4(SYS_io_uring_register, @bitCast(usize, @as(isize, fd)), opcode, @ptrToInt(arg), nr_args);
|
||||
pub fn io_uring_register(fd: i32, opcode: IORING_REGISTER, arg: ?*const c_void, nr_args: u32) usize {
|
||||
return syscall4(SYS_io_uring_register, @bitCast(usize, @as(isize, fd)), @enumToInt(opcode), @ptrToInt(arg), nr_args);
|
||||
}
|
||||
|
||||
pub fn memfd_create(name: [*:0]const u8, flags: u32) usize {
|
||||
|
||||
Reference in New Issue
Block a user