authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-23 14:05:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-29 06:20:51-07:00
logc87fbd58787823da6db48e0bc488b5344fe52d43
tree63c79258b2acba8e7182eef107c8eb82fb28a5e6
parent46f7e3ea9fff4b3f83cab58c20625d3961be6020

std.os.linux.IoUring: use linux msghdr

it disagrees with posix msghdr

1 files changed, 66 insertions(+), 66 deletions(-)

lib/std/os/linux/IoUring.zig+66-66
......@@ -10,7 +10,7 @@ const testing = std.testing;
1010const is_linux = builtin.os.tag == .linux;
1111const page_size_min = std.heap.page_size_min;
1212
13fd: posix.fd_t = -1,
13fd: linux.fd_t = -1,
1414sq: SubmissionQueue,
1515cq: CompletionQueue,
1616flags: u32,
......@@ -62,7 +62,7 @@ pub fn init_params(entries: u16, p: *linux.io_uring_params) !IoUring {
6262 .NOSYS => return error.SystemOutdated,
6363 else => |errno| return posix.unexpectedErrno(errno),
6464 }
65 const fd = @as(posix.fd_t, @intCast(res));
65 const fd = @as(linux.fd_t, @intCast(res));
6666 assert(fd >= 0);
6767 errdefer posix.close(fd);
6868
......@@ -341,7 +341,7 @@ pub fn cq_advance(self: *IoUring, count: u32) void {
341341/// apply to the write, since the fsync may complete before the write is issued to the disk.
342342/// You should preferably use `link_with_next_sqe()` on a write's SQE to link it with an fsync,
343343/// or else insert a full write barrier using `drain_previous_sqes()` when queueing an fsync.
344pub fn fsync(self: *IoUring, user_data: u64, fd: posix.fd_t, flags: u32) !*linux.io_uring_sqe {
344pub fn fsync(self: *IoUring, user_data: u64, fd: linux.fd_t, flags: u32) !*linux.io_uring_sqe {
345345 const sqe = try self.get_sqe();
346346 sqe.prep_fsync(fd, flags);
347347 sqe.user_data = user_data;
......@@ -386,7 +386,7 @@ pub const ReadBuffer = union(enum) {
386386pub fn read(
387387 self: *IoUring,
388388 user_data: u64,
389 fd: posix.fd_t,
389 fd: linux.fd_t,
390390 buffer: ReadBuffer,
391391 offset: u64,
392392) !*linux.io_uring_sqe {
......@@ -409,7 +409,7 @@ pub fn read(
409409pub fn write(
410410 self: *IoUring,
411411 user_data: u64,
412 fd: posix.fd_t,
412 fd: linux.fd_t,
413413 buffer: []const u8,
414414 offset: u64,
415415) !*linux.io_uring_sqe {
......@@ -433,7 +433,7 @@ pub fn write(
433433/// See https://github.com/axboe/liburing/issues/291
434434///
435435/// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
436pub fn splice(self: *IoUring, user_data: u64, fd_in: posix.fd_t, off_in: u64, fd_out: posix.fd_t, off_out: u64, len: usize) !*linux.io_uring_sqe {
436pub fn splice(self: *IoUring, user_data: u64, fd_in: linux.fd_t, off_in: u64, fd_out: linux.fd_t, off_out: u64, len: usize) !*linux.io_uring_sqe {
437437 const sqe = try self.get_sqe();
438438 sqe.prep_splice(fd_in, off_in, fd_out, off_out, len);
439439 sqe.user_data = user_data;
......@@ -448,7 +448,7 @@ pub fn splice(self: *IoUring, user_data: u64, fd_in: posix.fd_t, off_in: u64, fd
448448pub fn read_fixed(
449449 self: *IoUring,
450450 user_data: u64,
451 fd: posix.fd_t,
451 fd: linux.fd_t,
452452 buffer: *posix.iovec,
453453 offset: u64,
454454 buffer_index: u16,
......@@ -466,7 +466,7 @@ pub fn read_fixed(
466466pub fn writev(
467467 self: *IoUring,
468468 user_data: u64,
469 fd: posix.fd_t,
469 fd: linux.fd_t,
470470 iovecs: []const posix.iovec_const,
471471 offset: u64,
472472) !*linux.io_uring_sqe {
......@@ -484,7 +484,7 @@ pub fn writev(
484484pub fn write_fixed(
485485 self: *IoUring,
486486 user_data: u64,
487 fd: posix.fd_t,
487 fd: linux.fd_t,
488488 buffer: *posix.iovec,
489489 offset: u64,
490490 buffer_index: u16,
......@@ -501,7 +501,7 @@ pub fn write_fixed(
501501pub fn accept(
502502 self: *IoUring,
503503 user_data: u64,
504 fd: posix.fd_t,
504 fd: linux.fd_t,
505505 addr: ?*posix.sockaddr,
506506 addrlen: ?*posix.socklen_t,
507507 flags: u32,
......@@ -523,7 +523,7 @@ pub fn accept(
523523pub fn accept_multishot(
524524 self: *IoUring,
525525 user_data: u64,
526 fd: posix.fd_t,
526 fd: linux.fd_t,
527527 addr: ?*posix.sockaddr,
528528 addrlen: ?*posix.socklen_t,
529529 flags: u32,
......@@ -548,7 +548,7 @@ pub fn accept_multishot(
548548pub fn accept_direct(
549549 self: *IoUring,
550550 user_data: u64,
551 fd: posix.fd_t,
551 fd: linux.fd_t,
552552 addr: ?*posix.sockaddr,
553553 addrlen: ?*posix.socklen_t,
554554 flags: u32,
......@@ -564,7 +564,7 @@ pub fn accept_direct(
564564pub fn accept_multishot_direct(
565565 self: *IoUring,
566566 user_data: u64,
567 fd: posix.fd_t,
567 fd: linux.fd_t,
568568 addr: ?*posix.sockaddr,
569569 addrlen: ?*posix.socklen_t,
570570 flags: u32,
......@@ -580,7 +580,7 @@ pub fn accept_multishot_direct(
580580pub fn connect(
581581 self: *IoUring,
582582 user_data: u64,
583 fd: posix.fd_t,
583 fd: linux.fd_t,
584584 addr: *const posix.sockaddr,
585585 addrlen: posix.socklen_t,
586586) !*linux.io_uring_sqe {
......@@ -595,8 +595,8 @@ pub fn connect(
595595pub fn epoll_ctl(
596596 self: *IoUring,
597597 user_data: u64,
598 epfd: posix.fd_t,
599 fd: posix.fd_t,
598 epfd: linux.fd_t,
599 fd: linux.fd_t,
600600 op: u32,
601601 ev: ?*linux.epoll_event,
602602) !*linux.io_uring_sqe {
......@@ -626,7 +626,7 @@ pub const RecvBuffer = union(enum) {
626626pub fn recv(
627627 self: *IoUring,
628628 user_data: u64,
629 fd: posix.fd_t,
629 fd: linux.fd_t,
630630 buffer: RecvBuffer,
631631 flags: u32,
632632) !*linux.io_uring_sqe {
......@@ -650,7 +650,7 @@ pub fn recv(
650650pub fn send(
651651 self: *IoUring,
652652 user_data: u64,
653 fd: posix.fd_t,
653 fd: linux.fd_t,
654654 buffer: []const u8,
655655 flags: u32,
656656) !*linux.io_uring_sqe {
......@@ -678,7 +678,7 @@ pub fn send(
678678pub fn send_zc(
679679 self: *IoUring,
680680 user_data: u64,
681 fd: posix.fd_t,
681 fd: linux.fd_t,
682682 buffer: []const u8,
683683 send_flags: u32,
684684 zc_flags: u16,
......@@ -695,7 +695,7 @@ pub fn send_zc(
695695pub fn send_zc_fixed(
696696 self: *IoUring,
697697 user_data: u64,
698 fd: posix.fd_t,
698 fd: linux.fd_t,
699699 buffer: []const u8,
700700 send_flags: u32,
701701 zc_flags: u16,
......@@ -713,8 +713,8 @@ pub fn send_zc_fixed(
713713pub fn recvmsg(
714714 self: *IoUring,
715715 user_data: u64,
716 fd: posix.fd_t,
717 msg: *posix.msghdr,
716 fd: linux.fd_t,
717 msg: *linux.msghdr,
718718 flags: u32,
719719) !*linux.io_uring_sqe {
720720 const sqe = try self.get_sqe();
......@@ -729,8 +729,8 @@ pub fn recvmsg(
729729pub fn sendmsg(
730730 self: *IoUring,
731731 user_data: u64,
732 fd: posix.fd_t,
733 msg: *const posix.msghdr_const,
732 fd: linux.fd_t,
733 msg: *const linux.msghdr_const,
734734 flags: u32,
735735) !*linux.io_uring_sqe {
736736 const sqe = try self.get_sqe();
......@@ -745,8 +745,8 @@ pub fn sendmsg(
745745pub fn sendmsg_zc(
746746 self: *IoUring,
747747 user_data: u64,
748 fd: posix.fd_t,
749 msg: *const posix.msghdr_const,
748 fd: linux.fd_t,
749 msg: *const linux.msghdr_const,
750750 flags: u32,
751751) !*linux.io_uring_sqe {
752752 const sqe = try self.get_sqe();
......@@ -761,7 +761,7 @@ pub fn sendmsg_zc(
761761pub fn openat(
762762 self: *IoUring,
763763 user_data: u64,
764 fd: posix.fd_t,
764 fd: linux.fd_t,
765765 path: [*:0]const u8,
766766 flags: linux.O,
767767 mode: posix.mode_t,
......@@ -786,7 +786,7 @@ pub fn openat(
786786pub fn openat_direct(
787787 self: *IoUring,
788788 user_data: u64,
789 fd: posix.fd_t,
789 fd: linux.fd_t,
790790 path: [*:0]const u8,
791791 flags: linux.O,
792792 mode: posix.mode_t,
......@@ -801,7 +801,7 @@ pub fn openat_direct(
801801/// Queues (but does not submit) an SQE to perform a `close(2)`.
802802/// Returns a pointer to the SQE.
803803/// Available since 5.6.
804pub fn close(self: *IoUring, user_data: u64, fd: posix.fd_t) !*linux.io_uring_sqe {
804pub fn close(self: *IoUring, user_data: u64, fd: linux.fd_t) !*linux.io_uring_sqe {
805805 const sqe = try self.get_sqe();
806806 sqe.prep_close(fd);
807807 sqe.user_data = user_data;
......@@ -896,7 +896,7 @@ pub fn link_timeout(
896896pub fn poll_add(
897897 self: *IoUring,
898898 user_data: u64,
899 fd: posix.fd_t,
899 fd: linux.fd_t,
900900 poll_mask: u32,
901901) !*linux.io_uring_sqe {
902902 const sqe = try self.get_sqe();
......@@ -939,7 +939,7 @@ pub fn poll_update(
939939pub fn fallocate(
940940 self: *IoUring,
941941 user_data: u64,
942 fd: posix.fd_t,
942 fd: linux.fd_t,
943943 mode: i32,
944944 offset: u64,
945945 len: u64,
......@@ -955,7 +955,7 @@ pub fn fallocate(
955955pub fn statx(
956956 self: *IoUring,
957957 user_data: u64,
958 fd: posix.fd_t,
958 fd: linux.fd_t,
959959 path: [:0]const u8,
960960 flags: u32,
961961 mask: u32,
......@@ -1008,9 +1008,9 @@ pub fn shutdown(
10081008pub fn renameat(
10091009 self: *IoUring,
10101010 user_data: u64,
1011 old_dir_fd: posix.fd_t,
1011 old_dir_fd: linux.fd_t,
10121012 old_path: [*:0]const u8,
1013 new_dir_fd: posix.fd_t,
1013 new_dir_fd: linux.fd_t,
10141014 new_path: [*:0]const u8,
10151015 flags: u32,
10161016) !*linux.io_uring_sqe {
......@@ -1025,7 +1025,7 @@ pub fn renameat(
10251025pub fn unlinkat(
10261026 self: *IoUring,
10271027 user_data: u64,
1028 dir_fd: posix.fd_t,
1028 dir_fd: linux.fd_t,
10291029 path: [*:0]const u8,
10301030 flags: u32,
10311031) !*linux.io_uring_sqe {
......@@ -1040,7 +1040,7 @@ pub fn unlinkat(
10401040pub fn mkdirat(
10411041 self: *IoUring,
10421042 user_data: u64,
1043 dir_fd: posix.fd_t,
1043 dir_fd: linux.fd_t,
10441044 path: [*:0]const u8,
10451045 mode: posix.mode_t,
10461046) !*linux.io_uring_sqe {
......@@ -1056,7 +1056,7 @@ pub fn symlinkat(
10561056 self: *IoUring,
10571057 user_data: u64,
10581058 target: [*:0]const u8,
1059 new_dir_fd: posix.fd_t,
1059 new_dir_fd: linux.fd_t,
10601060 link_path: [*:0]const u8,
10611061) !*linux.io_uring_sqe {
10621062 const sqe = try self.get_sqe();
......@@ -1070,9 +1070,9 @@ pub fn symlinkat(
10701070pub fn linkat(
10711071 self: *IoUring,
10721072 user_data: u64,
1073 old_dir_fd: posix.fd_t,
1073 old_dir_fd: linux.fd_t,
10741074 old_path: [*:0]const u8,
1075 new_dir_fd: posix.fd_t,
1075 new_dir_fd: linux.fd_t,
10761076 new_path: [*:0]const u8,
10771077 flags: u32,
10781078) !*linux.io_uring_sqe {
......@@ -1144,7 +1144,7 @@ pub fn waitid(
11441144/// Registering file descriptors will wait for the ring to idle.
11451145/// Files are automatically unregistered by the kernel when the ring is torn down.
11461146/// An application need unregister only if it wants to register a new array of file descriptors.
1147pub fn register_files(self: *IoUring, fds: []const posix.fd_t) !void {
1147pub fn register_files(self: *IoUring, fds: []const linux.fd_t) !void {
11481148 assert(self.fd >= 0);
11491149 const res = linux.io_uring_register(
11501150 self.fd,
......@@ -1163,7 +1163,7 @@ pub fn register_files(self: *IoUring, fds: []const posix.fd_t) !void {
11631163/// * removing an existing entry (set the fd to -1)
11641164/// * replacing an existing entry with a new fd
11651165/// Adding new file descriptors must be done with `register_files`.
1166pub fn register_files_update(self: *IoUring, offset: u32, fds: []const posix.fd_t) !void {
1166pub fn register_files_update(self: *IoUring, offset: u32, fds: []const linux.fd_t) !void {
11671167 assert(self.fd >= 0);
11681168
11691169 const FilesUpdate = extern struct {
......@@ -1232,7 +1232,7 @@ pub fn register_file_alloc_range(self: *IoUring, offset: u32, len: u32) !void {
12321232/// Registers the file descriptor for an eventfd that will be notified of completion events on
12331233/// an io_uring instance.
12341234/// Only a single a eventfd can be registered at any given point in time.
1235pub fn register_eventfd(self: *IoUring, fd: posix.fd_t) !void {
1235pub fn register_eventfd(self: *IoUring, fd: linux.fd_t) !void {
12361236 assert(self.fd >= 0);
12371237 const res = linux.io_uring_register(
12381238 self.fd,
......@@ -1247,7 +1247,7 @@ pub fn register_eventfd(self: *IoUring, fd: posix.fd_t) !void {
12471247/// an io_uring instance. Notifications are only posted for events that complete in an async manner.
12481248/// This means that events that complete inline while being submitted do not trigger a notification event.
12491249/// Only a single eventfd can be registered at any given point in time.
1250pub fn register_eventfd_async(self: *IoUring, fd: posix.fd_t) !void {
1250pub fn register_eventfd_async(self: *IoUring, fd: linux.fd_t) !void {
12511251 assert(self.fd >= 0);
12521252 const res = linux.io_uring_register(
12531253 self.fd,
......@@ -1405,7 +1405,7 @@ pub fn socket_direct_alloc(
14051405pub fn bind(
14061406 self: *IoUring,
14071407 user_data: u64,
1408 fd: posix.fd_t,
1408 fd: linux.fd_t,
14091409 addr: *const posix.sockaddr,
14101410 addrlen: posix.socklen_t,
14111411 flags: u32,
......@@ -1422,7 +1422,7 @@ pub fn bind(
14221422pub fn listen(
14231423 self: *IoUring,
14241424 user_data: u64,
1425 fd: posix.fd_t,
1425 fd: linux.fd_t,
14261426 backlog: usize,
14271427 flags: u32,
14281428) !*linux.io_uring_sqe {
......@@ -1513,7 +1513,7 @@ pub const SubmissionQueue = struct {
15131513 sqe_head: u32 = 0,
15141514 sqe_tail: u32 = 0,
15151515
1516 pub fn init(fd: posix.fd_t, p: linux.io_uring_params) !SubmissionQueue {
1516 pub fn init(fd: linux.fd_t, p: linux.io_uring_params) !SubmissionQueue {
15171517 assert(fd >= 0);
15181518 assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0);
15191519 const size = @max(
......@@ -1576,7 +1576,7 @@ pub const CompletionQueue = struct {
15761576 overflow: *u32,
15771577 cqes: []linux.io_uring_cqe,
15781578
1579 pub fn init(fd: posix.fd_t, p: linux.io_uring_params, sq: SubmissionQueue) !CompletionQueue {
1579 pub fn init(fd: linux.fd_t, p: linux.io_uring_params, sq: SubmissionQueue) !CompletionQueue {
15801580 assert(fd >= 0);
15811581 assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0);
15821582 const mmap = sq.mmap;
......@@ -1677,7 +1677,7 @@ pub const BufferGroup = struct {
16771677 }
16781678
16791679 // Prepare recv operation which will select buffer from this group.
1680 pub fn recv(self: *BufferGroup, user_data: u64, fd: posix.fd_t, flags: u32) !*linux.io_uring_sqe {
1680 pub fn recv(self: *BufferGroup, user_data: u64, fd: linux.fd_t, flags: u32) !*linux.io_uring_sqe {
16811681 var sqe = try self.ring.get_sqe();
16821682 sqe.prep_rw(.RECV, fd, 0, 0, 0);
16831683 sqe.rw_flags = flags;
......@@ -1688,7 +1688,7 @@ pub const BufferGroup = struct {
16881688 }
16891689
16901690 // Prepare multishot recv operation which will select buffer from this group.
1691 pub fn recv_multishot(self: *BufferGroup, user_data: u64, fd: posix.fd_t, flags: u32) !*linux.io_uring_sqe {
1691 pub fn recv_multishot(self: *BufferGroup, user_data: u64, fd: linux.fd_t, flags: u32) !*linux.io_uring_sqe {
16921692 var sqe = try self.recv(user_data, fd, flags);
16931693 sqe.ioprio |= linux.IORING_RECV_MULTISHOT;
16941694 return sqe;
......@@ -1732,7 +1732,7 @@ pub const BufferGroup = struct {
17321732/// `entries` is the number of entries requested in the buffer ring, must be power of 2.
17331733/// `group_id` is the chosen buffer group ID, unique in IO_Uring.
17341734pub fn setup_buf_ring(
1735 fd: posix.fd_t,
1735 fd: linux.fd_t,
17361736 entries: u16,
17371737 group_id: u16,
17381738 flags: linux.io_uring_buf_reg.Flags,
......@@ -1758,7 +1758,7 @@ pub fn setup_buf_ring(
17581758}
17591759
17601760fn register_buf_ring(
1761 fd: posix.fd_t,
1761 fd: linux.fd_t,
17621762 addr: u64,
17631763 entries: u32,
17641764 group_id: u16,
......@@ -1780,7 +1780,7 @@ fn register_buf_ring(
17801780 try handle_register_buf_ring_result(res);
17811781}
17821782
1783fn unregister_buf_ring(fd: posix.fd_t, group_id: u16) !void {
1783fn unregister_buf_ring(fd: linux.fd_t, group_id: u16) !void {
17841784 var reg = mem.zeroInit(linux.io_uring_buf_reg, .{
17851785 .bgid = group_id,
17861786 });
......@@ -1802,7 +1802,7 @@ fn handle_register_buf_ring_result(res: usize) !void {
18021802}
18031803
18041804// Unregisters a previously registered shared buffer ring, returned from io_uring_setup_buf_ring.
1805pub fn free_buf_ring(fd: posix.fd_t, br: *align(page_size_min) linux.io_uring_buf_ring, entries: u32, group_id: u16) void {
1805pub fn free_buf_ring(fd: linux.fd_t, br: *align(page_size_min) linux.io_uring_buf_ring, entries: u32, group_id: u16) void {
18061806 unregister_buf_ring(fd, group_id) catch {};
18071807 var mmap: []align(page_size_min) u8 = undefined;
18081808 mmap.ptr = @ptrCast(br);
......@@ -1873,7 +1873,7 @@ test "nop" {
18731873 };
18741874 defer {
18751875 ring.deinit();
1876 testing.expectEqual(@as(posix.fd_t, -1), ring.fd) catch @panic("test failed");
1876 testing.expectEqual(@as(linux.fd_t, -1), ring.fd) catch @panic("test failed");
18771877 }
18781878
18791879 const sqe = try ring.nop(0xaaaaaaaa);
......@@ -1949,7 +1949,7 @@ test "readv" {
19491949 // https://github.com/torvalds/linux/blob/v5.4/fs/io_uring.c#L3119-L3124 vs
19501950 // https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L6687-L6691
19511951 // We therefore avoid stressing sparse fd sets here:
1952 var registered_fds = [_]posix.fd_t{0} ** 1;
1952 var registered_fds = [_]linux.fd_t{0} ** 1;
19531953 const fd_index = 0;
19541954 registered_fds[fd_index] = fd;
19551955 try ring.register_files(registered_fds[0..]);
......@@ -2383,7 +2383,7 @@ test "sendmsg/recvmsg" {
23832383 const iovecs_send = [_]posix.iovec_const{
23842384 posix.iovec_const{ .base = &buffer_send, .len = buffer_send.len },
23852385 };
2386 const msg_send: posix.msghdr_const = .{
2386 const msg_send: linux.msghdr_const = .{
23872387 .name = addrAny(&address_server),
23882388 .namelen = @sizeOf(linux.sockaddr.in),
23892389 .iov = &iovecs_send,
......@@ -2405,7 +2405,7 @@ test "sendmsg/recvmsg" {
24052405 .port = 0,
24062406 .addr = 0,
24072407 };
2408 var msg_recv: posix.msghdr = .{
2408 var msg_recv: linux.msghdr = .{
24092409 .name = addrAny(&address_recv),
24102410 .namelen = @sizeOf(linux.sockaddr.in),
24112411 .iov = &iovecs_recv,
......@@ -2785,7 +2785,7 @@ test "register_files_update" {
27852785 const fd = try posix.openZ("/dev/zero", .{ .ACCMODE = .RDONLY, .CLOEXEC = true }, 0);
27862786 defer posix.close(fd);
27872787
2788 var registered_fds = [_]posix.fd_t{0} ** 2;
2788 var registered_fds = [_]linux.fd_t{0} ** 2;
27892789 const fd_index = 0;
27902790 const fd_index2 = 1;
27912791 registered_fds[fd_index] = fd;
......@@ -3764,7 +3764,7 @@ test "accept_direct" {
37643764 };
37653765
37663766 // register direct file descriptors
3767 var registered_fds = [_]posix.fd_t{-1} ** 2;
3767 var registered_fds = [_]linux.fd_t{-1} ** 2;
37683768 try ring.register_files(registered_fds[0..]);
37693769
37703770 const listener_socket = try createListenerSocket(&address);
......@@ -3847,7 +3847,7 @@ test "accept_multishot_direct" {
38473847 .addr = @bitCast([4]u8{ 127, 0, 0, 1 }),
38483848 };
38493849
3850 var registered_fds = [_]posix.fd_t{-1} ** 2;
3850 var registered_fds = [_]linux.fd_t{-1} ** 2;
38513851 try ring.register_files(registered_fds[0..]);
38523852
38533853 const listener_socket = try createListenerSocket(&address);
......@@ -3910,7 +3910,7 @@ test "socket" {
39103910 // test completion
39113911 var cqe = try ring.copy_cqe();
39123912 try testing.expectEqual(posix.E.SUCCESS, cqe.err());
3913 const fd: posix.fd_t = @intCast(cqe.res);
3913 const fd: linux.fd_t = @intCast(cqe.res);
39143914 try testing.expect(fd > 2);
39153915
39163916 posix.close(fd);
......@@ -3926,7 +3926,7 @@ test "socket_direct/socket_direct_alloc/close_direct" {
39263926 };
39273927 defer ring.deinit();
39283928
3929 var registered_fds = [_]posix.fd_t{-1} ** 3;
3929 var registered_fds = [_]linux.fd_t{-1} ** 3;
39303930 try ring.register_files(registered_fds[0..]);
39313931
39323932 // create socket in registered file descriptor at index 0 (last param)
......@@ -4007,7 +4007,7 @@ test "openat_direct/close_direct" {
40074007 };
40084008 defer ring.deinit();
40094009
4010 var registered_fds = [_]posix.fd_t{-1} ** 3;
4010 var registered_fds = [_]linux.fd_t{-1} ** 3;
40114011 try ring.register_files(registered_fds[0..]);
40124012
40134013 var tmp = std.testing.tmpDir(.{});
......@@ -4394,7 +4394,7 @@ test "ring mapped buffers multishot recv" {
43944394fn buf_grp_recv_submit_get_cqe(
43954395 ring: *IoUring,
43964396 buf_grp: *BufferGroup,
4397 fd: posix.fd_t,
4397 fd: linux.fd_t,
43984398 user_data: u64,
43994399) !linux.io_uring_cqe {
44004400 // prepare and submit recv
......@@ -4507,7 +4507,7 @@ test "bind/listen/connect" {
45074507 var cqe = try ring.copy_cqe();
45084508 try testing.expectEqual(1, cqe.user_data);
45094509 try testing.expectEqual(posix.E.SUCCESS, cqe.err());
4510 const listen_fd: posix.fd_t = @intCast(cqe.res);
4510 const listen_fd: linux.fd_t = @intCast(cqe.res);
45114511 try testing.expect(listen_fd > 2);
45124512
45134513 // Prepare: set socket option * 2, bind, listen
......@@ -4549,7 +4549,7 @@ test "bind/listen/connect" {
45494549 try testing.expectEqual(6, cqe.user_data);
45504550 try testing.expectEqual(posix.E.SUCCESS, cqe.err());
45514551 // Get connect socket fd
4552 const connect_fd: posix.fd_t = @intCast(cqe.res);
4552 const connect_fd: linux.fd_t = @intCast(cqe.res);
45534553 try testing.expect(connect_fd > 2 and connect_fd != listen_fd);
45544554 break :brk connect_fd;
45554555 };