diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-03-26 11:39:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-26 11:39:56 +0100 |
| commit | b350049f51d1964d83ba7c0024fe601908bb185e (patch) | |
| tree | 895338b9110c60f071554931597f6c242eb4bedd /lib/std/os/linux.zig | |
| parent | a7ff042f983247e7852c47675a3fb4571a655621 (diff) | |
| parent | 94b36dbe50a90172a57e0ab828079fcb2b7cfcfc (diff) | |
| download | zig-b350049f51d1964d83ba7c0024fe601908bb185e.tar.gz zig-b350049f51d1964d83ba7c0024fe601908bb185e.zip | |
Merge pull request #23062 from ianic/io_uring_bind
io_uring: Update to kernel changes in 6.11 and 6.12
Diffstat (limited to 'lib/std/os/linux.zig')
| -rw-r--r-- | lib/std/os/linux.zig | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index d224a45a8f..b05ea412c5 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -5806,6 +5806,9 @@ pub const IORING_OP = enum(u8) { FUTEX_WAITV, FIXED_FD_INSTALL, FTRUNCATE, + BIND, + LISTEN, + RECV_ZC, _, }; @@ -5930,6 +5933,8 @@ pub const IORING_CQE_F_MORE = 1 << 1; pub const IORING_CQE_F_SOCK_NONEMPTY = 1 << 2; /// Set for notification CQEs. Can be used to distinct them from sends. pub const IORING_CQE_F_NOTIF = 1 << 3; +/// If set, the buffer ID set in the completion will get more completions. +pub const IORING_CQE_F_BUF_MORE = 1 << 4; pub const IORING_CQE_BUFFER_SHIFT = 16; @@ -6135,26 +6140,32 @@ pub const IO_URING_OP_SUPPORTED = 1 << 0; pub const io_uring_probe_op = extern struct { op: IORING_OP, - resv: u8, - /// IO_URING_OP_* flags flags: u16, - resv2: u32, + + pub fn is_supported(self: @This()) bool { + return self.flags & IO_URING_OP_SUPPORTED != 0; + } }; pub const io_uring_probe = extern struct { - /// last opcode supported + /// Last opcode supported last_op: IORING_OP, - - /// Number of io_uring_probe_op following + /// Length of ops[] array below ops_len: u8, - resv: u16, resv2: [3]u32, - - // Followed by up to `ops_len` io_uring_probe_op structures + ops: [256]io_uring_probe_op, + + /// Is the operation supported on the running kernel. + pub fn is_supported(self: @This(), op: IORING_OP) bool { + const i = @intFromEnum(op); + if (i > @intFromEnum(self.last_op) or i >= self.ops_len) + return false; + return self.ops[i].is_supported(); + } }; pub const io_uring_restriction = extern struct { @@ -6190,6 +6201,13 @@ pub const IORING_RESTRICTION = enum(u16) { _, }; +pub const IO_URING_SOCKET_OP = enum(u16) { + SIOCIN = 0, + SIOCOUTQ = 1, + GETSOCKOPT = 2, + SETSOCKOPT = 3, +}; + pub const io_uring_buf = extern struct { addr: u64, len: u32, @@ -6209,8 +6227,15 @@ pub const io_uring_buf_reg = extern struct { ring_addr: u64, ring_entries: u32, bgid: u16, - pad: u16, + flags: Flags, resv: [3]u64, + + pub const Flags = packed struct { + _0: u1 = 0, + /// Incremental buffer consumption. + inc: bool, + _: u14 = 0, + }; }; pub const io_uring_getevents_arg = extern struct { |
