authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-27 04:44:25-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-10-27 04:44:25-04:00
log29b05897a5e25e699f176b37ba558eea2694136b
treee5edf5441f7b28374d8d2d6ab472530c01e14cc8
parent87735e4daec618196e7d0d37359906fe96e12b39
parent28b848e3f09f2774a06863438ffff59a8e67f780
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #17734 from joadnacer/iouring-update

std.linux: Update io_uring structs and consts for kernel 6.3.8

2 files changed, 278 insertions(+), 111 deletions(-)

lib/std/os/linux.zig+252-93
......@@ -3740,35 +3740,6 @@ else
37403740 fields: siginfo_fields_union,
37413741 };
37423742
3743pub const io_uring_params = extern struct {
3744 sq_entries: u32,
3745 cq_entries: u32,
3746 flags: u32,
3747 sq_thread_cpu: u32,
3748 sq_thread_idle: u32,
3749 features: u32,
3750 wq_fd: u32,
3751 resv: [3]u32,
3752 sq_off: io_sqring_offsets,
3753 cq_off: io_cqring_offsets,
3754};
3755
3756// io_uring_params.features flags
3757
3758pub const IORING_FEAT_SINGLE_MMAP = 1 << 0;
3759pub const IORING_FEAT_NODROP = 1 << 1;
3760pub const IORING_FEAT_SUBMIT_STABLE = 1 << 2;
3761pub const IORING_FEAT_RW_CUR_POS = 1 << 3;
3762pub const IORING_FEAT_CUR_PERSONALITY = 1 << 4;
3763pub const IORING_FEAT_FAST_POLL = 1 << 5;
3764pub const IORING_FEAT_POLL_32BITS = 1 << 6;
3765pub const IORING_FEAT_SQPOLL_NONFIXED = 1 << 7;
3766pub const IORING_FEAT_EXT_ARG = 1 << 8;
3767pub const IORING_FEAT_NATIVE_WORKERS = 1 << 9;
3768pub const IORING_FEAT_RSRC_TAGS = 1 << 10;
3769pub const IORING_FEAT_CQE_SKIP = 1 << 11;
3770pub const IORING_FEAT_LINKED_FILE = 1 << 12;
3771
37723743// io_uring_params.flags
37733744
37743745/// io_context is polled
......@@ -3812,53 +3783,15 @@ pub const IORING_SETUP_SQE128 = 1 << 10;
38123783/// CQEs are 32 byte
38133784pub const IORING_SETUP_CQE32 = 1 << 11;
38143785
3815pub const io_sqring_offsets = extern struct {
3816 /// offset of ring head
3817 head: u32,
3818
3819 /// offset of ring tail
3820 tail: u32,
3821
3822 /// ring mask value
3823 ring_mask: u32,
3824
3825 /// entries in ring
3826 ring_entries: u32,
3786/// Only one task is allowed to submit requests
3787pub const IORING_SETUP_SINGLE_ISSUER = 1 << 12;
38273788
3828 /// ring flags
3829 flags: u32,
3830
3831 /// number of sqes not submitted
3832 dropped: u32,
3833
3834 /// sqe index array
3835 array: u32,
3836
3837 resv1: u32,
3838 user_addr: u64,
3839};
3840
3841// io_sqring_offsets.flags
3842
3843/// needs io_uring_enter wakeup
3844pub const IORING_SQ_NEED_WAKEUP = 1 << 0;
3845/// kernel has cqes waiting beyond the cq ring
3846pub const IORING_SQ_CQ_OVERFLOW = 1 << 1;
3847/// task should enter the kernel
3848pub const IORING_SQ_TASKRUN = 1 << 2;
3849
3850pub const io_cqring_offsets = extern struct {
3851 head: u32,
3852 tail: u32,
3853 ring_mask: u32,
3854 ring_entries: u32,
3855 overflow: u32,
3856 cqes: u32,
3857 flags: u32,
3858 resv: u32,
3859 user_addr: u64,
3860};
3789/// Defer running task work to get events.
3790/// Rather than running bits of task work whenever the task transitions
3791/// try to do it just before it is needed.
3792pub const IORING_SETUP_DEFER_TASKRUN = 1 << 13;
38613793
3794/// IO submission data structure (Submission Queue Entry)
38623795pub const io_uring_sqe = extern struct {
38633796 opcode: IORING_OP,
38643797 flags: u8,
......@@ -3872,9 +3805,18 @@ pub const io_uring_sqe = extern struct {
38723805 buf_index: u16,
38733806 personality: u16,
38743807 splice_fd_in: i32,
3875 __pad2: [2]u64,
3808 addr3: u64,
3809 resv: u64,
38763810};
38773811
3812/// If sqe->file_index is set to this for opcodes that instantiate a new
3813/// direct descriptor (like openat/openat2/accept), then io_uring will allocate
3814/// an available direct descriptor instead of having the application pass one
3815/// in. The picked direct descriptor will be returned in cqe->res, or -ENFILE
3816/// if the space is full.
3817/// Available since Linux 5.19
3818pub const IORING_FILE_INDEX_ALLOC = maxInt(u32);
3819
38783820pub const IOSQE_BIT = enum(u8) {
38793821 FIXED_FILE,
38803822 IO_DRAIN,
......@@ -3964,6 +3906,10 @@ pub const IORING_OP = enum(u8) {
39643906
39653907 _,
39663908};
3909// io_uring_sqe.uring_cmd_flags (rw_flags in the Zig struct)
3910
3911/// use registered buffer; pass thig flag along with setting sqe->buf_index.
3912pub const IORING_URING_CMD_FIXED = 1 << 0;
39673913
39683914// io_uring_sqe.fsync_flags (rw_flags in the Zig struct)
39693915pub const IORING_FSYNC_DATASYNC = 1 << 0;
......@@ -3990,6 +3936,7 @@ pub const IORING_POLL_ADD_MULTI = 1 << 0;
39903936/// Update existing poll request, matching sqe->addr as the old user_data field.
39913937pub const IORING_POLL_UPDATE_EVENTS = 1 << 1;
39923938pub const IORING_POLL_UPDATE_USER_DATA = 1 << 2;
3939pub const IORING_POLL_ADD_LEVEL = 1 << 3;
39933940
39943941// ASYNC_CANCEL flags.
39953942
......@@ -3999,6 +3946,8 @@ pub const IORING_ASYNC_CANCEL_ALL = 1 << 0;
39993946pub const IORING_ASYNC_CANCEL_FD = 1 << 1;
40003947/// Match any request
40013948pub const IORING_ASYNC_CANCEL_ANY = 1 << 2;
3949/// 'fd' passed in is a fixed descriptor. Available since Linux 6.0
3950pub const IORING_ASYNC_CANCEL_FD_FIXED = 1 << 3;
40023951
40033952// send/sendmsg and recv/recvmsg flags (sqe->ioprio)
40043953
......@@ -4007,10 +3956,32 @@ pub const IORING_ASYNC_CANCEL_ANY = 1 << 2;
40073956pub const IORING_RECVSEND_POLL_FIRST = 1 << 0;
40083957/// Multishot recv. Sets IORING_CQE_F_MORE if the handler will continue to report CQEs on behalf of the same SQE.
40093958pub const IORING_RECV_MULTISHOT = 1 << 1;
4010
4011/// accept flags stored in sqe->ioprio
3959/// Use registered buffers, the index is stored in the buf_index field.
3960pub const IORING_RECVSEND_FIXED_BUF = 1 << 2;
3961/// If set, SEND[MSG]_ZC should report the zerocopy usage in cqe.res for the IORING_CQE_F_NOTIF cqe.
3962pub const IORING_SEND_ZC_REPORT_USAGE = 1 << 3;
3963/// CQE.RES FOR IORING_CQE_F_NOTIF if IORING_SEND_ZC_REPORT_USAGE was requested
3964pub const IORING_NOTIF_USAGE_ZC_COPIED = 1 << 31;
3965
3966/// accept flags stored in sqe->iopri
40123967pub const IORING_ACCEPT_MULTISHOT = 1 << 0;
40133968
3969/// IORING_OP_MSG_RING command types, stored in sqe->addr
3970pub const IORING_MSG_RING_COMMAND = enum(u8) {
3971 /// pass sqe->len as 'res' and off as user_data
3972 DATA,
3973 /// send a registered fd to another ring
3974 SEND_FD,
3975};
3976
3977// io_uring_sqe.msg_ring_flags (rw_flags in the Zig struct)
3978
3979/// Don't post a CQE to the target ring. Not applicable for IORING_MSG_DATA, obviously.
3980pub const IORING_MSG_RING_CQE_SKIP = 1 << 0;
3981
3982/// Pass through the flags from sqe->file_index (splice_fd_in in the zig struct) to cqe->flags */
3983pub const IORING_MSG_RING_FLAGS_PASS = 1 << 1;
3984
40143985// IO completion data structure (Completion Queue Entry)
40153986pub const io_uring_cqe = extern struct {
40163987 /// io_uring_sqe.data submission passed back
......@@ -4020,6 +3991,8 @@ pub const io_uring_cqe = extern struct {
40203991 res: i32,
40213992 flags: u32,
40223993
3994 // Followed by 16 bytes of padding if initialized with IORING_SETUP_CQE32, doubling cqe size
3995
40233996 pub fn err(self: io_uring_cqe) E {
40243997 if (self.res > -4096 and self.res < 0) {
40253998 return @as(E, @enumFromInt(-self.res));
......@@ -4040,11 +4013,66 @@ pub const IORING_CQE_F_SOCK_NONEMPTY = 1 << 2;
40404013/// Set for notification CQEs. Can be used to distinct them from sends.
40414014pub const IORING_CQE_F_NOTIF = 1 << 3;
40424015
4016pub const IORING_CQE_BUFFER_SHIFT = 16;
4017
40434018/// Magic offsets for the application to mmap the data it needs
40444019pub const IORING_OFF_SQ_RING = 0;
40454020pub const IORING_OFF_CQ_RING = 0x8000000;
40464021pub const IORING_OFF_SQES = 0x10000000;
40474022
4023/// Filled with the offset for mmap(2)
4024pub const io_sqring_offsets = extern struct {
4025 /// offset of ring head
4026 head: u32,
4027
4028 /// offset of ring tail
4029 tail: u32,
4030
4031 /// ring mask value
4032 ring_mask: u32,
4033
4034 /// entries in ring
4035 ring_entries: u32,
4036
4037 /// ring flags
4038 flags: u32,
4039
4040 /// number of sqes not submitted
4041 dropped: u32,
4042
4043 /// sqe index array
4044 array: u32,
4045
4046 resv1: u32,
4047 resv2: u64,
4048};
4049
4050// io_sqring_offsets.flags
4051
4052/// needs io_uring_enter wakeup
4053pub const IORING_SQ_NEED_WAKEUP = 1 << 0;
4054/// kernel has cqes waiting beyond the cq ring
4055pub const IORING_SQ_CQ_OVERFLOW = 1 << 1;
4056/// task should enter the kernel
4057pub const IORING_SQ_TASKRUN = 1 << 2;
4058
4059pub const io_cqring_offsets = extern struct {
4060 head: u32,
4061 tail: u32,
4062 ring_mask: u32,
4063 ring_entries: u32,
4064 overflow: u32,
4065 cqes: u32,
4066 flags: u32,
4067 resv: u32,
4068 user_addr: u64,
4069};
4070
4071// io_cqring_offsets.flags
4072
4073/// disable eventfd notifications
4074pub const IORING_CQ_EVENTFD_DISABLED = 1 << 0;
4075
40484076// io_uring_enter flags
40494077pub const IORING_ENTER_GETEVENTS = 1 << 0;
40504078pub const IORING_ENTER_SQ_WAKEUP = 1 << 1;
......@@ -4052,8 +4080,37 @@ pub const IORING_ENTER_SQ_WAIT = 1 << 2;
40524080pub const IORING_ENTER_EXT_ARG = 1 << 3;
40534081pub const IORING_ENTER_REGISTERED_RING = 1 << 4;
40544082
4083pub const io_uring_params = extern struct {
4084 sq_entries: u32,
4085 cq_entries: u32,
4086 flags: u32,
4087 sq_thread_cpu: u32,
4088 sq_thread_idle: u32,
4089 features: u32,
4090 wq_fd: u32,
4091 resv: [3]u32,
4092 sq_off: io_sqring_offsets,
4093 cq_off: io_cqring_offsets,
4094};
4095
4096// io_uring_params.features flags
4097
4098pub const IORING_FEAT_SINGLE_MMAP = 1 << 0;
4099pub const IORING_FEAT_NODROP = 1 << 1;
4100pub const IORING_FEAT_SUBMIT_STABLE = 1 << 2;
4101pub const IORING_FEAT_RW_CUR_POS = 1 << 3;
4102pub const IORING_FEAT_CUR_PERSONALITY = 1 << 4;
4103pub const IORING_FEAT_FAST_POLL = 1 << 5;
4104pub const IORING_FEAT_POLL_32BITS = 1 << 6;
4105pub const IORING_FEAT_SQPOLL_NONFIXED = 1 << 7;
4106pub const IORING_FEAT_EXT_ARG = 1 << 8;
4107pub const IORING_FEAT_NATIVE_WORKERS = 1 << 9;
4108pub const IORING_FEAT_RSRC_TAGS = 1 << 10;
4109pub const IORING_FEAT_CQE_SKIP = 1 << 11;
4110pub const IORING_FEAT_LINKED_FILE = 1 << 12;
4111
40554112// io_uring_register opcodes and arguments
4056pub const IORING_REGISTER = enum(u8) {
4113pub const IORING_REGISTER = enum(u32) {
40574114 REGISTER_BUFFERS,
40584115 UNREGISTER_BUFFERS,
40594116 REGISTER_FILES,
......@@ -4069,41 +4126,93 @@ pub const IORING_REGISTER = enum(u8) {
40694126 REGISTER_ENABLE_RINGS,
40704127
40714128 // extended with tagging
4072 IORING_REGISTER_FILES2,
4073 IORING_REGISTER_FILES_UPDATE2,
4074 IORING_REGISTER_BUFFERS2,
4075 IORING_REGISTER_BUFFERS_UPDATE,
4129 REGISTER_FILES2,
4130 REGISTER_FILES_UPDATE2,
4131 REGISTER_BUFFERS2,
4132 REGISTER_BUFFERS_UPDATE,
40764133
40774134 // set/clear io-wq thread affinities
4078 IORING_REGISTER_IOWQ_AFF,
4079 IORING_UNREGISTER_IOWQ_AFF,
4135 REGISTER_IOWQ_AFF,
4136 UNREGISTER_IOWQ_AFF,
40804137
40814138 // set/get max number of io-wq workers
4082 IORING_REGISTER_IOWQ_MAX_WORKERS,
4139 REGISTER_IOWQ_MAX_WORKERS,
40834140
40844141 // register/unregister io_uring fd with the ring
4085 IORING_REGISTER_RING_FDS,
4086 IORING_UNREGISTER_RING_FDS,
4142 REGISTER_RING_FDS,
4143 NREGISTER_RING_FDS,
40874144
40884145 // register ring based provide buffer group
4089 IORING_REGISTER_PBUF_RING,
4090 IORING_UNREGISTER_PBUF_RING,
4146 REGISTER_PBUF_RING,
4147 UNREGISTER_PBUF_RING,
40914148
40924149 // sync cancelation API
4093 IORING_REGISTER_SYNC_CANCEL,
4150 REGISTER_SYNC_CANCEL,
40944151
40954152 // register a range of fixed file slots for automatic slot allocation
4096 IORING_REGISTER_FILE_ALLOC_RANGE,
4153 REGISTER_FILE_ALLOC_RANGE,
4154
4155 // flag added to the opcode to use a registered ring fd
4156 IORING_REGISTER_USE_REGISTERED_RING = 1 << 31,
40974157
40984158 _,
40994159};
41004160
4161/// io_uring_restriction->opcode values
4162pub const IOWQ_CATEGORIES = enum(u8) {
4163 BOUND,
4164 UNBOUND,
4165};
4166
4167/// deprecated, see struct io_uring_rsrc_update
41014168pub const io_uring_files_update = extern struct {
41024169 offset: u32,
41034170 resv: u32,
41044171 fds: u64,
41054172};
41064173
4174/// Register a fully sparse file space, rather than pass in an array of all -1 file descriptors.
4175pub const IORING_RSRC_REGISTER_SPARSE = 1 << 0;
4176
4177pub const io_uring_rsrc_register = extern struct {
4178 nr: u32,
4179 flags: u32,
4180 resv2: u64,
4181 data: u64,
4182 tags: u64,
4183};
4184
4185pub const io_uring_rsrc_update = extern struct {
4186 offset: u32,
4187 resv: u32,
4188 data: u64,
4189};
4190
4191pub const io_uring_rsrc_update2 = extern struct {
4192 offset: u32,
4193 resv: u32,
4194 data: u64,
4195 tags: u64,
4196 nr: u32,
4197 resv2: u32,
4198};
4199
4200pub const io_uring_notification_slot = extern struct {
4201 tag: u64,
4202 resv: [3]u64,
4203};
4204
4205pub const io_uring_notification_register = extern struct {
4206 nr_slots: u32,
4207 resv: u32,
4208 resv2: u64,
4209 data: u64,
4210 resv3: u64,
4211};
4212
4213/// Skip updating fd indexes set to this value in the fd table */
4214pub const IORING_REGISTER_FILES_SKIP = -2;
4215
41074216pub const IO_URING_OP_SUPPORTED = 1 << 0;
41084217
41094218pub const io_uring_probe_op = extern struct {
......@@ -4131,7 +4240,7 @@ pub const io_uring_probe = extern struct {
41314240};
41324241
41334242pub const io_uring_restriction = extern struct {
4134 opcode: u16,
4243 opcode: IORING_RESTRICTION,
41354244 arg: extern union {
41364245 /// IORING_RESTRICTION_REGISTER_OP
41374246 register_op: IORING_REGISTER,
......@@ -4147,7 +4256,7 @@ pub const io_uring_restriction = extern struct {
41474256};
41484257
41494258/// io_uring_restriction->opcode values
4150pub const IORING_RESTRICTION = enum(u8) {
4259pub const IORING_RESTRICTION = enum(u16) {
41514260 /// Allow an io_uring_register(2) opcode
41524261 REGISTER_OP = 0,
41534262
......@@ -4163,6 +4272,56 @@ pub const IORING_RESTRICTION = enum(u8) {
41634272 _,
41644273};
41654274
4275pub const io_uring_buf = extern struct {
4276 addr: u64,
4277 len: u32,
4278 bid: u16,
4279 resv: u16,
4280};
4281
4282// io_uring_buf_ring struct omitted
4283// it's a io_uring_buf array with the resv of the first item used as a "tail" field.
4284
4285/// argument for IORING_(UN)REGISTER_PBUF_RING
4286pub const io_uring_buf_reg = extern struct {
4287 ring_addr: u64,
4288 ring_entries: u32,
4289 bgid: u16,
4290 pad: u16,
4291 resv: [3]u64,
4292};
4293
4294pub const io_uring_getevents_arg = extern struct {
4295 sigmask: u64,
4296 sigmask_sz: u32,
4297 pad: u32,
4298 ts: u64,
4299};
4300
4301/// Argument for IORING_REGISTER_SYNC_CANCEL
4302pub const io_uring_sync_cancel_reg = extern struct {
4303 addr: u64,
4304 fd: i32,
4305 flags: u32,
4306 timeout: kernel_timespec,
4307 pad: [4]u64,
4308};
4309
4310/// Argument for IORING_REGISTER_FILE_ALLOC_RANGE
4311/// The range is specified as [off, off + len)
4312pub const io_uring_file_index_range = extern struct {
4313 off: u32,
4314 len: u32,
4315 resv: u64,
4316};
4317
4318pub const io_uring_recvmsg_out = extern struct {
4319 namelen: u32,
4320 controllen: u32,
4321 payloadlen: u32,
4322 flags: u32,
4323};
4324
41664325pub const utsname = extern struct {
41674326 sysname: [64:0]u8,
41684327 nodename: [64:0]u8,
lib/std/os/linux/io_uring.zig+26-18
......@@ -415,10 +415,10 @@ pub const IO_Uring = struct {
415415
416416 /// Queues (but does not submit) an SQE to perform a `splice(2)`
417417 /// Either `fd_in` or `fd_out` must be a pipe.
418 /// If `fd_in` refers to a pipe, `off_in` is ignored and must be set to -1.
419 /// If `fd_in` does not refer to a pipe and `off_in` is -1, then `len` are read
418 /// If `fd_in` refers to a pipe, `off_in` is ignored and must be set to std.math.maxInt(u64).
419 /// If `fd_in` does not refer to a pipe and `off_in` is maxInt(u64), then `len` are read
420420 /// from `fd_in` starting from the file offset, which is incremented by the number of bytes read.
421 /// If `fd_in` does not refer to a pipe and `off_in` is not -1, then the starting offset of `fd_in` will be `off_in`.
421 /// If `fd_in` does not refer to a pipe and `off_in` is not maxInt(u64), then the starting offset of `fd_in` will be `off_in`.
422422 /// This splice operation can be used to implement sendfile by splicing to an intermediate pipe first,
423423 /// then splice to the final destination. In fact, the implementation of sendfile in kernel uses splice internally.
424424 ///
......@@ -427,7 +427,7 @@ pub const IO_Uring = struct {
427427 /// See https://github.com/axboe/liburing/issues/291
428428 ///
429429 /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
430 pub fn splice(self: *IO_Uring, user_data: u64, fd_in: os.fd_t, off_in: i64, fd_out: os.fd_t, off_out: i64, len: usize) !*linux.io_uring_sqe {
430 pub fn splice(self: *IO_Uring, user_data: u64, fd_in: os.fd_t, off_in: u64, fd_out: os.fd_t, off_out: u64, len: usize) !*linux.io_uring_sqe {
431431 const sqe = try self.get_sqe();
432432 io_uring_prep_splice(sqe, fd_in, off_in, fd_out, off_out, len);
433433 sqe.user_data = user_data;
......@@ -1210,7 +1210,8 @@ pub fn io_uring_prep_nop(sqe: *linux.io_uring_sqe) void {
12101210 .buf_index = 0,
12111211 .personality = 0,
12121212 .splice_fd_in = 0,
1213 .__pad2 = [2]u64{ 0, 0 },
1213 .addr3 = 0,
1214 .resv = 0,
12141215 };
12151216}
12161217
......@@ -1228,7 +1229,8 @@ pub fn io_uring_prep_fsync(sqe: *linux.io_uring_sqe, fd: os.fd_t, flags: u32) vo
12281229 .buf_index = 0,
12291230 .personality = 0,
12301231 .splice_fd_in = 0,
1231 .__pad2 = [2]u64{ 0, 0 },
1232 .addr3 = 0,
1233 .resv = 0,
12321234 };
12331235}
12341236
......@@ -1253,7 +1255,8 @@ pub fn io_uring_prep_rw(
12531255 .buf_index = 0,
12541256 .personality = 0,
12551257 .splice_fd_in = 0,
1256 .__pad2 = [2]u64{ 0, 0 },
1258 .addr3 = 0,
1259 .resv = 0,
12571260 };
12581261}
12591262
......@@ -1265,9 +1268,9 @@ pub fn io_uring_prep_write(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []cons
12651268 io_uring_prep_rw(.WRITE, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, offset);
12661269}
12671270
1268pub fn io_uring_prep_splice(sqe: *linux.io_uring_sqe, fd_in: os.fd_t, off_in: i64, fd_out: os.fd_t, off_out: i64, len: usize) void {
1269 io_uring_prep_rw(.SPLICE, sqe, fd_out, undefined, len, @bitCast(off_out));
1270 sqe.addr = @bitCast(off_in);
1271pub fn io_uring_prep_splice(sqe: *linux.io_uring_sqe, fd_in: os.fd_t, off_in: u64, fd_out: os.fd_t, off_out: u64, len: usize) void {
1272 io_uring_prep_rw(.SPLICE, sqe, fd_out, undefined, len, off_out);
1273 sqe.addr = off_in;
12711274 sqe.splice_fd_in = fd_in;
12721275}
12731276
......@@ -1397,7 +1400,8 @@ pub fn io_uring_prep_close(sqe: *linux.io_uring_sqe, fd: os.fd_t) void {
13971400 .buf_index = 0,
13981401 .personality = 0,
13991402 .splice_fd_in = 0,
1400 .__pad2 = [2]u64{ 0, 0 },
1403 .addr3 = 0,
1404 .resv = 0,
14011405 };
14021406}
14031407
......@@ -1425,7 +1429,8 @@ pub fn io_uring_prep_timeout_remove(sqe: *linux.io_uring_sqe, timeout_user_data:
14251429 .buf_index = 0,
14261430 .personality = 0,
14271431 .splice_fd_in = 0,
1428 .__pad2 = [2]u64{ 0, 0 },
1432 .addr3 = 0,
1433 .resv = 0,
14291434 };
14301435}
14311436
......@@ -1485,7 +1490,8 @@ pub fn io_uring_prep_fallocate(
14851490 .buf_index = 0,
14861491 .personality = 0,
14871492 .splice_fd_in = 0,
1488 .__pad2 = [2]u64{ 0, 0 },
1493 .addr3 = 0,
1494 .resv = 0,
14891495 };
14901496}
14911497
......@@ -1657,7 +1663,8 @@ test "nop" {
16571663 .buf_index = 0,
16581664 .personality = 0,
16591665 .splice_fd_in = 0,
1660 .__pad2 = [2]u64{ 0, 0 },
1666 .addr3 = 0,
1667 .resv = 0,
16611668 }, sqe.*);
16621669
16631670 try testing.expectEqual(@as(u32, 0), ring.sq.sqe_head);
......@@ -1881,17 +1888,17 @@ test "splice/read" {
18811888 _ = try file_src.write(&buffer_write);
18821889
18831890 var fds = try os.pipe();
1884 const pipe_offset: i64 = -1;
1891 const pipe_offset: u64 = std.math.maxInt(u64);
18851892
18861893 const sqe_splice_to_pipe = try ring.splice(0x11111111, fd_src, 0, fds[1], pipe_offset, buffer_write.len);
18871894 try testing.expectEqual(linux.IORING_OP.SPLICE, sqe_splice_to_pipe.opcode);
18881895 try testing.expectEqual(@as(u64, 0), sqe_splice_to_pipe.addr);
1889 try testing.expectEqual(@as(u64, @bitCast((pipe_offset))), sqe_splice_to_pipe.off);
1896 try testing.expectEqual(pipe_offset, sqe_splice_to_pipe.off);
18901897 sqe_splice_to_pipe.flags |= linux.IOSQE_IO_LINK;
18911898
18921899 const sqe_splice_from_pipe = try ring.splice(0x22222222, fds[0], pipe_offset, fd_dst, 10, buffer_write.len);
18931900 try testing.expectEqual(linux.IORING_OP.SPLICE, sqe_splice_from_pipe.opcode);
1894 try testing.expectEqual(@as(u64, @bitCast(pipe_offset)), sqe_splice_from_pipe.addr);
1901 try testing.expectEqual(pipe_offset, sqe_splice_from_pipe.addr);
18951902 try testing.expectEqual(@as(u64, 10), sqe_splice_from_pipe.off);
18961903 sqe_splice_from_pipe.flags |= linux.IOSQE_IO_LINK;
18971904
......@@ -2028,7 +2035,8 @@ test "openat" {
20282035 .buf_index = 0,
20292036 .personality = 0,
20302037 .splice_fd_in = 0,
2031 .__pad2 = [2]u64{ 0, 0 },
2038 .addr3 = 0,
2039 .resv = 0,
20322040 }, sqe_openat.*);
20332041 try testing.expectEqual(@as(u32, 1), try ring.submit());
20342042