| ... | @@ -10,7 +10,7 @@ const testing = std.testing; | ... | @@ -10,7 +10,7 @@ const testing = std.testing; |
| 10 | const is_linux = builtin.os.tag == .linux; | 10 | const is_linux = builtin.os.tag == .linux; |
| 11 | const page_size_min = std.heap.page_size_min; | 11 | const page_size_min = std.heap.page_size_min; |
| 12 | | 12 | |
| 13 | fd: posix.fd_t = -1, | 13 | fd: linux.fd_t = -1, |
| 14 | sq: SubmissionQueue, | 14 | sq: SubmissionQueue, |
| 15 | cq: CompletionQueue, | 15 | cq: CompletionQueue, |
| 16 | flags: u32, | 16 | flags: u32, |
| ... | @@ -62,7 +62,7 @@ pub fn init_params(entries: u16, p: *linux.io_uring_params) !IoUring { | ... | @@ -62,7 +62,7 @@ pub fn init_params(entries: u16, p: *linux.io_uring_params) !IoUring { |
| 62 | .NOSYS => return error.SystemOutdated, | 62 | .NOSYS => return error.SystemOutdated, |
| 63 | else => |errno| return posix.unexpectedErrno(errno), | 63 | else => |errno| return posix.unexpectedErrno(errno), |
| 64 | } | 64 | } |
| 65 | const fd = @as(posix.fd_t, @intCast(res)); | 65 | const fd = @as(linux.fd_t, @intCast(res)); |
| 66 | assert(fd >= 0); | 66 | assert(fd >= 0); |
| 67 | errdefer posix.close(fd); | 67 | errdefer posix.close(fd); |
| 68 | | 68 | |
| ... | @@ -341,7 +341,7 @@ pub fn cq_advance(self: *IoUring, count: u32) void { | ... | @@ -341,7 +341,7 @@ pub fn cq_advance(self: *IoUring, count: u32) void { |
| 341 | /// apply to the write, since the fsync may complete before the write is issued to the disk. | 341 | /// apply to the write, since the fsync may complete before the write is issued to the disk. |
| 342 | /// You should preferably use `link_with_next_sqe()` on a write's SQE to link it with an fsync, | 342 | /// You should preferably use `link_with_next_sqe()` on a write's SQE to link it with an fsync, |
| 343 | /// or else insert a full write barrier using `drain_previous_sqes()` when queueing an fsync. | 343 | /// or else insert a full write barrier using `drain_previous_sqes()` when queueing an fsync. |
| 344 | pub fn fsync(self: *IoUring, user_data: u64, fd: posix.fd_t, flags: u32) !*linux.io_uring_sqe { | 344 | pub fn fsync(self: *IoUring, user_data: u64, fd: linux.fd_t, flags: u32) !*linux.io_uring_sqe { |
| 345 | const sqe = try self.get_sqe(); | 345 | const sqe = try self.get_sqe(); |
| 346 | sqe.prep_fsync(fd, flags); | 346 | sqe.prep_fsync(fd, flags); |
| 347 | sqe.user_data = user_data; | 347 | sqe.user_data = user_data; |
| ... | @@ -386,7 +386,7 @@ pub const ReadBuffer = union(enum) { | ... | @@ -386,7 +386,7 @@ pub const ReadBuffer = union(enum) { |
| 386 | pub fn read( | 386 | pub fn read( |
| 387 | self: *IoUring, | 387 | self: *IoUring, |
| 388 | user_data: u64, | 388 | user_data: u64, |
| 389 | fd: posix.fd_t, | 389 | fd: linux.fd_t, |
| 390 | buffer: ReadBuffer, | 390 | buffer: ReadBuffer, |
| 391 | offset: u64, | 391 | offset: u64, |
| 392 | ) !*linux.io_uring_sqe { | 392 | ) !*linux.io_uring_sqe { |
| ... | @@ -409,7 +409,7 @@ pub fn read( | ... | @@ -409,7 +409,7 @@ pub fn read( |
| 409 | pub fn write( | 409 | pub fn write( |
| 410 | self: *IoUring, | 410 | self: *IoUring, |
| 411 | user_data: u64, | 411 | user_data: u64, |
| 412 | fd: posix.fd_t, | 412 | fd: linux.fd_t, |
| 413 | buffer: []const u8, | 413 | buffer: []const u8, |
| 414 | offset: u64, | 414 | offset: u64, |
| 415 | ) !*linux.io_uring_sqe { | 415 | ) !*linux.io_uring_sqe { |
| ... | @@ -433,7 +433,7 @@ pub fn write( | ... | @@ -433,7 +433,7 @@ pub fn write( |
| 433 | /// See https://github.com/axboe/liburing/issues/291 | 433 | /// See https://github.com/axboe/liburing/issues/291 |
| 434 | /// | 434 | /// |
| 435 | /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. | 435 | /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. |
| 436 | pub 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 { | 436 | pub 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 { |
| 437 | const sqe = try self.get_sqe(); | 437 | const sqe = try self.get_sqe(); |
| 438 | sqe.prep_splice(fd_in, off_in, fd_out, off_out, len); | 438 | sqe.prep_splice(fd_in, off_in, fd_out, off_out, len); |
| 439 | sqe.user_data = user_data; | 439 | 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 | ... | @@ -448,7 +448,7 @@ pub fn splice(self: *IoUring, user_data: u64, fd_in: posix.fd_t, off_in: u64, fd |
| 448 | pub fn read_fixed( | 448 | pub fn read_fixed( |
| 449 | self: *IoUring, | 449 | self: *IoUring, |
| 450 | user_data: u64, | 450 | user_data: u64, |
| 451 | fd: posix.fd_t, | 451 | fd: linux.fd_t, |
| 452 | buffer: *posix.iovec, | 452 | buffer: *posix.iovec, |
| 453 | offset: u64, | 453 | offset: u64, |
| 454 | buffer_index: u16, | 454 | buffer_index: u16, |
| ... | @@ -466,7 +466,7 @@ pub fn read_fixed( | ... | @@ -466,7 +466,7 @@ pub fn read_fixed( |
| 466 | pub fn writev( | 466 | pub fn writev( |
| 467 | self: *IoUring, | 467 | self: *IoUring, |
| 468 | user_data: u64, | 468 | user_data: u64, |
| 469 | fd: posix.fd_t, | 469 | fd: linux.fd_t, |
| 470 | iovecs: []const posix.iovec_const, | 470 | iovecs: []const posix.iovec_const, |
| 471 | offset: u64, | 471 | offset: u64, |
| 472 | ) !*linux.io_uring_sqe { | 472 | ) !*linux.io_uring_sqe { |
| ... | @@ -484,7 +484,7 @@ pub fn writev( | ... | @@ -484,7 +484,7 @@ pub fn writev( |
| 484 | pub fn write_fixed( | 484 | pub fn write_fixed( |
| 485 | self: *IoUring, | 485 | self: *IoUring, |
| 486 | user_data: u64, | 486 | user_data: u64, |
| 487 | fd: posix.fd_t, | 487 | fd: linux.fd_t, |
| 488 | buffer: *posix.iovec, | 488 | buffer: *posix.iovec, |
| 489 | offset: u64, | 489 | offset: u64, |
| 490 | buffer_index: u16, | 490 | buffer_index: u16, |
| ... | @@ -501,7 +501,7 @@ pub fn write_fixed( | ... | @@ -501,7 +501,7 @@ pub fn write_fixed( |
| 501 | pub fn accept( | 501 | pub fn accept( |
| 502 | self: *IoUring, | 502 | self: *IoUring, |
| 503 | user_data: u64, | 503 | user_data: u64, |
| 504 | fd: posix.fd_t, | 504 | fd: linux.fd_t, |
| 505 | addr: ?*posix.sockaddr, | 505 | addr: ?*posix.sockaddr, |
| 506 | addrlen: ?*posix.socklen_t, | 506 | addrlen: ?*posix.socklen_t, |
| 507 | flags: u32, | 507 | flags: u32, |
| ... | @@ -523,7 +523,7 @@ pub fn accept( | ... | @@ -523,7 +523,7 @@ pub fn accept( |
| 523 | pub fn accept_multishot( | 523 | pub fn accept_multishot( |
| 524 | self: *IoUring, | 524 | self: *IoUring, |
| 525 | user_data: u64, | 525 | user_data: u64, |
| 526 | fd: posix.fd_t, | 526 | fd: linux.fd_t, |
| 527 | addr: ?*posix.sockaddr, | 527 | addr: ?*posix.sockaddr, |
| 528 | addrlen: ?*posix.socklen_t, | 528 | addrlen: ?*posix.socklen_t, |
| 529 | flags: u32, | 529 | flags: u32, |
| ... | @@ -548,7 +548,7 @@ pub fn accept_multishot( | ... | @@ -548,7 +548,7 @@ pub fn accept_multishot( |
| 548 | pub fn accept_direct( | 548 | pub fn accept_direct( |
| 549 | self: *IoUring, | 549 | self: *IoUring, |
| 550 | user_data: u64, | 550 | user_data: u64, |
| 551 | fd: posix.fd_t, | 551 | fd: linux.fd_t, |
| 552 | addr: ?*posix.sockaddr, | 552 | addr: ?*posix.sockaddr, |
| 553 | addrlen: ?*posix.socklen_t, | 553 | addrlen: ?*posix.socklen_t, |
| 554 | flags: u32, | 554 | flags: u32, |
| ... | @@ -564,7 +564,7 @@ pub fn accept_direct( | ... | @@ -564,7 +564,7 @@ pub fn accept_direct( |
| 564 | pub fn accept_multishot_direct( | 564 | pub fn accept_multishot_direct( |
| 565 | self: *IoUring, | 565 | self: *IoUring, |
| 566 | user_data: u64, | 566 | user_data: u64, |
| 567 | fd: posix.fd_t, | 567 | fd: linux.fd_t, |
| 568 | addr: ?*posix.sockaddr, | 568 | addr: ?*posix.sockaddr, |
| 569 | addrlen: ?*posix.socklen_t, | 569 | addrlen: ?*posix.socklen_t, |
| 570 | flags: u32, | 570 | flags: u32, |
| ... | @@ -580,7 +580,7 @@ pub fn accept_multishot_direct( | ... | @@ -580,7 +580,7 @@ pub fn accept_multishot_direct( |
| 580 | pub fn connect( | 580 | pub fn connect( |
| 581 | self: *IoUring, | 581 | self: *IoUring, |
| 582 | user_data: u64, | 582 | user_data: u64, |
| 583 | fd: posix.fd_t, | 583 | fd: linux.fd_t, |
| 584 | addr: *const posix.sockaddr, | 584 | addr: *const posix.sockaddr, |
| 585 | addrlen: posix.socklen_t, | 585 | addrlen: posix.socklen_t, |
| 586 | ) !*linux.io_uring_sqe { | 586 | ) !*linux.io_uring_sqe { |
| ... | @@ -595,8 +595,8 @@ pub fn connect( | ... | @@ -595,8 +595,8 @@ pub fn connect( |
| 595 | pub fn epoll_ctl( | 595 | pub fn epoll_ctl( |
| 596 | self: *IoUring, | 596 | self: *IoUring, |
| 597 | user_data: u64, | 597 | user_data: u64, |
| 598 | epfd: posix.fd_t, | 598 | epfd: linux.fd_t, |
| 599 | fd: posix.fd_t, | 599 | fd: linux.fd_t, |
| 600 | op: u32, | 600 | op: u32, |
| 601 | ev: ?*linux.epoll_event, | 601 | ev: ?*linux.epoll_event, |
| 602 | ) !*linux.io_uring_sqe { | 602 | ) !*linux.io_uring_sqe { |
| ... | @@ -626,7 +626,7 @@ pub const RecvBuffer = union(enum) { | ... | @@ -626,7 +626,7 @@ pub const RecvBuffer = union(enum) { |
| 626 | pub fn recv( | 626 | pub fn recv( |
| 627 | self: *IoUring, | 627 | self: *IoUring, |
| 628 | user_data: u64, | 628 | user_data: u64, |
| 629 | fd: posix.fd_t, | 629 | fd: linux.fd_t, |
| 630 | buffer: RecvBuffer, | 630 | buffer: RecvBuffer, |
| 631 | flags: u32, | 631 | flags: u32, |
| 632 | ) !*linux.io_uring_sqe { | 632 | ) !*linux.io_uring_sqe { |
| ... | @@ -650,7 +650,7 @@ pub fn recv( | ... | @@ -650,7 +650,7 @@ pub fn recv( |
| 650 | pub fn send( | 650 | pub fn send( |
| 651 | self: *IoUring, | 651 | self: *IoUring, |
| 652 | user_data: u64, | 652 | user_data: u64, |
| 653 | fd: posix.fd_t, | 653 | fd: linux.fd_t, |
| 654 | buffer: []const u8, | 654 | buffer: []const u8, |
| 655 | flags: u32, | 655 | flags: u32, |
| 656 | ) !*linux.io_uring_sqe { | 656 | ) !*linux.io_uring_sqe { |
| ... | @@ -678,7 +678,7 @@ pub fn send( | ... | @@ -678,7 +678,7 @@ pub fn send( |
| 678 | pub fn send_zc( | 678 | pub fn send_zc( |
| 679 | self: *IoUring, | 679 | self: *IoUring, |
| 680 | user_data: u64, | 680 | user_data: u64, |
| 681 | fd: posix.fd_t, | 681 | fd: linux.fd_t, |
| 682 | buffer: []const u8, | 682 | buffer: []const u8, |
| 683 | send_flags: u32, | 683 | send_flags: u32, |
| 684 | zc_flags: u16, | 684 | zc_flags: u16, |
| ... | @@ -695,7 +695,7 @@ pub fn send_zc( | ... | @@ -695,7 +695,7 @@ pub fn send_zc( |
| 695 | pub fn send_zc_fixed( | 695 | pub fn send_zc_fixed( |
| 696 | self: *IoUring, | 696 | self: *IoUring, |
| 697 | user_data: u64, | 697 | user_data: u64, |
| 698 | fd: posix.fd_t, | 698 | fd: linux.fd_t, |
| 699 | buffer: []const u8, | 699 | buffer: []const u8, |
| 700 | send_flags: u32, | 700 | send_flags: u32, |
| 701 | zc_flags: u16, | 701 | zc_flags: u16, |
| ... | @@ -713,8 +713,8 @@ pub fn send_zc_fixed( | ... | @@ -713,8 +713,8 @@ pub fn send_zc_fixed( |
| 713 | pub fn recvmsg( | 713 | pub fn recvmsg( |
| 714 | self: *IoUring, | 714 | self: *IoUring, |
| 715 | user_data: u64, | 715 | user_data: u64, |
| 716 | fd: posix.fd_t, | 716 | fd: linux.fd_t, |
| 717 | msg: *posix.msghdr, | 717 | msg: *linux.msghdr, |
| 718 | flags: u32, | 718 | flags: u32, |
| 719 | ) !*linux.io_uring_sqe { | 719 | ) !*linux.io_uring_sqe { |
| 720 | const sqe = try self.get_sqe(); | 720 | const sqe = try self.get_sqe(); |
| ... | @@ -729,8 +729,8 @@ pub fn recvmsg( | ... | @@ -729,8 +729,8 @@ pub fn recvmsg( |
| 729 | pub fn sendmsg( | 729 | pub fn sendmsg( |
| 730 | self: *IoUring, | 730 | self: *IoUring, |
| 731 | user_data: u64, | 731 | user_data: u64, |
| 732 | fd: posix.fd_t, | 732 | fd: linux.fd_t, |
| 733 | msg: *const posix.msghdr_const, | 733 | msg: *const linux.msghdr_const, |
| 734 | flags: u32, | 734 | flags: u32, |
| 735 | ) !*linux.io_uring_sqe { | 735 | ) !*linux.io_uring_sqe { |
| 736 | const sqe = try self.get_sqe(); | 736 | const sqe = try self.get_sqe(); |
| ... | @@ -745,8 +745,8 @@ pub fn sendmsg( | ... | @@ -745,8 +745,8 @@ pub fn sendmsg( |
| 745 | pub fn sendmsg_zc( | 745 | pub fn sendmsg_zc( |
| 746 | self: *IoUring, | 746 | self: *IoUring, |
| 747 | user_data: u64, | 747 | user_data: u64, |
| 748 | fd: posix.fd_t, | 748 | fd: linux.fd_t, |
| 749 | msg: *const posix.msghdr_const, | 749 | msg: *const linux.msghdr_const, |
| 750 | flags: u32, | 750 | flags: u32, |
| 751 | ) !*linux.io_uring_sqe { | 751 | ) !*linux.io_uring_sqe { |
| 752 | const sqe = try self.get_sqe(); | 752 | const sqe = try self.get_sqe(); |
| ... | @@ -761,7 +761,7 @@ pub fn sendmsg_zc( | ... | @@ -761,7 +761,7 @@ pub fn sendmsg_zc( |
| 761 | pub fn openat( | 761 | pub fn openat( |
| 762 | self: *IoUring, | 762 | self: *IoUring, |
| 763 | user_data: u64, | 763 | user_data: u64, |
| 764 | fd: posix.fd_t, | 764 | fd: linux.fd_t, |
| 765 | path: [*:0]const u8, | 765 | path: [*:0]const u8, |
| 766 | flags: linux.O, | 766 | flags: linux.O, |
| 767 | mode: posix.mode_t, | 767 | mode: posix.mode_t, |
| ... | @@ -786,7 +786,7 @@ pub fn openat( | ... | @@ -786,7 +786,7 @@ pub fn openat( |
| 786 | pub fn openat_direct( | 786 | pub fn openat_direct( |
| 787 | self: *IoUring, | 787 | self: *IoUring, |
| 788 | user_data: u64, | 788 | user_data: u64, |
| 789 | fd: posix.fd_t, | 789 | fd: linux.fd_t, |
| 790 | path: [*:0]const u8, | 790 | path: [*:0]const u8, |
| 791 | flags: linux.O, | 791 | flags: linux.O, |
| 792 | mode: posix.mode_t, | 792 | mode: posix.mode_t, |
| ... | @@ -801,7 +801,7 @@ pub fn openat_direct( | ... | @@ -801,7 +801,7 @@ pub fn openat_direct( |
| 801 | /// Queues (but does not submit) an SQE to perform a `close(2)`. | 801 | /// Queues (but does not submit) an SQE to perform a `close(2)`. |
| 802 | /// Returns a pointer to the SQE. | 802 | /// Returns a pointer to the SQE. |
| 803 | /// Available since 5.6. | 803 | /// Available since 5.6. |
| 804 | pub fn close(self: *IoUring, user_data: u64, fd: posix.fd_t) !*linux.io_uring_sqe { | 804 | pub fn close(self: *IoUring, user_data: u64, fd: linux.fd_t) !*linux.io_uring_sqe { |
| 805 | const sqe = try self.get_sqe(); | 805 | const sqe = try self.get_sqe(); |
| 806 | sqe.prep_close(fd); | 806 | sqe.prep_close(fd); |
| 807 | sqe.user_data = user_data; | 807 | sqe.user_data = user_data; |
| ... | @@ -896,7 +896,7 @@ pub fn link_timeout( | ... | @@ -896,7 +896,7 @@ pub fn link_timeout( |
| 896 | pub fn poll_add( | 896 | pub fn poll_add( |
| 897 | self: *IoUring, | 897 | self: *IoUring, |
| 898 | user_data: u64, | 898 | user_data: u64, |
| 899 | fd: posix.fd_t, | 899 | fd: linux.fd_t, |
| 900 | poll_mask: u32, | 900 | poll_mask: u32, |
| 901 | ) !*linux.io_uring_sqe { | 901 | ) !*linux.io_uring_sqe { |
| 902 | const sqe = try self.get_sqe(); | 902 | const sqe = try self.get_sqe(); |
| ... | @@ -939,7 +939,7 @@ pub fn poll_update( | ... | @@ -939,7 +939,7 @@ pub fn poll_update( |
| 939 | pub fn fallocate( | 939 | pub fn fallocate( |
| 940 | self: *IoUring, | 940 | self: *IoUring, |
| 941 | user_data: u64, | 941 | user_data: u64, |
| 942 | fd: posix.fd_t, | 942 | fd: linux.fd_t, |
| 943 | mode: i32, | 943 | mode: i32, |
| 944 | offset: u64, | 944 | offset: u64, |
| 945 | len: u64, | 945 | len: u64, |
| ... | @@ -955,7 +955,7 @@ pub fn fallocate( | ... | @@ -955,7 +955,7 @@ pub fn fallocate( |
| 955 | pub fn statx( | 955 | pub fn statx( |
| 956 | self: *IoUring, | 956 | self: *IoUring, |
| 957 | user_data: u64, | 957 | user_data: u64, |
| 958 | fd: posix.fd_t, | 958 | fd: linux.fd_t, |
| 959 | path: [:0]const u8, | 959 | path: [:0]const u8, |
| 960 | flags: u32, | 960 | flags: u32, |
| 961 | mask: u32, | 961 | mask: u32, |
| ... | @@ -1008,9 +1008,9 @@ pub fn shutdown( | ... | @@ -1008,9 +1008,9 @@ pub fn shutdown( |
| 1008 | pub fn renameat( | 1008 | pub fn renameat( |
| 1009 | self: *IoUring, | 1009 | self: *IoUring, |
| 1010 | user_data: u64, | 1010 | user_data: u64, |
| 1011 | old_dir_fd: posix.fd_t, | 1011 | old_dir_fd: linux.fd_t, |
| 1012 | old_path: [*:0]const u8, | 1012 | old_path: [*:0]const u8, |
| 1013 | new_dir_fd: posix.fd_t, | 1013 | new_dir_fd: linux.fd_t, |
| 1014 | new_path: [*:0]const u8, | 1014 | new_path: [*:0]const u8, |
| 1015 | flags: u32, | 1015 | flags: u32, |
| 1016 | ) !*linux.io_uring_sqe { | 1016 | ) !*linux.io_uring_sqe { |
| ... | @@ -1025,7 +1025,7 @@ pub fn renameat( | ... | @@ -1025,7 +1025,7 @@ pub fn renameat( |
| 1025 | pub fn unlinkat( | 1025 | pub fn unlinkat( |
| 1026 | self: *IoUring, | 1026 | self: *IoUring, |
| 1027 | user_data: u64, | 1027 | user_data: u64, |
| 1028 | dir_fd: posix.fd_t, | 1028 | dir_fd: linux.fd_t, |
| 1029 | path: [*:0]const u8, | 1029 | path: [*:0]const u8, |
| 1030 | flags: u32, | 1030 | flags: u32, |
| 1031 | ) !*linux.io_uring_sqe { | 1031 | ) !*linux.io_uring_sqe { |
| ... | @@ -1040,7 +1040,7 @@ pub fn unlinkat( | ... | @@ -1040,7 +1040,7 @@ pub fn unlinkat( |
| 1040 | pub fn mkdirat( | 1040 | pub fn mkdirat( |
| 1041 | self: *IoUring, | 1041 | self: *IoUring, |
| 1042 | user_data: u64, | 1042 | user_data: u64, |
| 1043 | dir_fd: posix.fd_t, | 1043 | dir_fd: linux.fd_t, |
| 1044 | path: [*:0]const u8, | 1044 | path: [*:0]const u8, |
| 1045 | mode: posix.mode_t, | 1045 | mode: posix.mode_t, |
| 1046 | ) !*linux.io_uring_sqe { | 1046 | ) !*linux.io_uring_sqe { |
| ... | @@ -1056,7 +1056,7 @@ pub fn symlinkat( | ... | @@ -1056,7 +1056,7 @@ pub fn symlinkat( |
| 1056 | self: *IoUring, | 1056 | self: *IoUring, |
| 1057 | user_data: u64, | 1057 | user_data: u64, |
| 1058 | target: [*:0]const u8, | 1058 | target: [*:0]const u8, |
| 1059 | new_dir_fd: posix.fd_t, | 1059 | new_dir_fd: linux.fd_t, |
| 1060 | link_path: [*:0]const u8, | 1060 | link_path: [*:0]const u8, |
| 1061 | ) !*linux.io_uring_sqe { | 1061 | ) !*linux.io_uring_sqe { |
| 1062 | const sqe = try self.get_sqe(); | 1062 | const sqe = try self.get_sqe(); |
| ... | @@ -1070,9 +1070,9 @@ pub fn symlinkat( | ... | @@ -1070,9 +1070,9 @@ pub fn symlinkat( |
| 1070 | pub fn linkat( | 1070 | pub fn linkat( |
| 1071 | self: *IoUring, | 1071 | self: *IoUring, |
| 1072 | user_data: u64, | 1072 | user_data: u64, |
| 1073 | old_dir_fd: posix.fd_t, | 1073 | old_dir_fd: linux.fd_t, |
| 1074 | old_path: [*:0]const u8, | 1074 | old_path: [*:0]const u8, |
| 1075 | new_dir_fd: posix.fd_t, | 1075 | new_dir_fd: linux.fd_t, |
| 1076 | new_path: [*:0]const u8, | 1076 | new_path: [*:0]const u8, |
| 1077 | flags: u32, | 1077 | flags: u32, |
| 1078 | ) !*linux.io_uring_sqe { | 1078 | ) !*linux.io_uring_sqe { |
| ... | @@ -1144,7 +1144,7 @@ pub fn waitid( | ... | @@ -1144,7 +1144,7 @@ pub fn waitid( |
| 1144 | /// Registering file descriptors will wait for the ring to idle. | 1144 | /// Registering file descriptors will wait for the ring to idle. |
| 1145 | /// Files are automatically unregistered by the kernel when the ring is torn down. | 1145 | /// Files are automatically unregistered by the kernel when the ring is torn down. |
| 1146 | /// An application need unregister only if it wants to register a new array of file descriptors. | 1146 | /// An application need unregister only if it wants to register a new array of file descriptors. |
| 1147 | pub fn register_files(self: *IoUring, fds: []const posix.fd_t) !void { | 1147 | pub fn register_files(self: *IoUring, fds: []const linux.fd_t) !void { |
| 1148 | assert(self.fd >= 0); | 1148 | assert(self.fd >= 0); |
| 1149 | const res = linux.io_uring_register( | 1149 | const res = linux.io_uring_register( |
| 1150 | self.fd, | 1150 | self.fd, |
| ... | @@ -1163,7 +1163,7 @@ pub fn register_files(self: *IoUring, fds: []const posix.fd_t) !void { | ... | @@ -1163,7 +1163,7 @@ pub fn register_files(self: *IoUring, fds: []const posix.fd_t) !void { |
| 1163 | /// * removing an existing entry (set the fd to -1) | 1163 | /// * removing an existing entry (set the fd to -1) |
| 1164 | /// * replacing an existing entry with a new fd | 1164 | /// * replacing an existing entry with a new fd |
| 1165 | /// Adding new file descriptors must be done with `register_files`. | 1165 | /// Adding new file descriptors must be done with `register_files`. |
| 1166 | pub fn register_files_update(self: *IoUring, offset: u32, fds: []const posix.fd_t) !void { | 1166 | pub fn register_files_update(self: *IoUring, offset: u32, fds: []const linux.fd_t) !void { |
| 1167 | assert(self.fd >= 0); | 1167 | assert(self.fd >= 0); |
| 1168 | | 1168 | |
| 1169 | const FilesUpdate = extern struct { | 1169 | const FilesUpdate = extern struct { |
| ... | @@ -1232,7 +1232,7 @@ pub fn register_file_alloc_range(self: *IoUring, offset: u32, len: u32) !void { | ... | @@ -1232,7 +1232,7 @@ pub fn register_file_alloc_range(self: *IoUring, offset: u32, len: u32) !void { |
| 1232 | /// Registers the file descriptor for an eventfd that will be notified of completion events on | 1232 | /// Registers the file descriptor for an eventfd that will be notified of completion events on |
| 1233 | /// an io_uring instance. | 1233 | /// an io_uring instance. |
| 1234 | /// Only a single a eventfd can be registered at any given point in time. | 1234 | /// Only a single a eventfd can be registered at any given point in time. |
| 1235 | pub fn register_eventfd(self: *IoUring, fd: posix.fd_t) !void { | 1235 | pub fn register_eventfd(self: *IoUring, fd: linux.fd_t) !void { |
| 1236 | assert(self.fd >= 0); | 1236 | assert(self.fd >= 0); |
| 1237 | const res = linux.io_uring_register( | 1237 | const res = linux.io_uring_register( |
| 1238 | self.fd, | 1238 | self.fd, |
| ... | @@ -1247,7 +1247,7 @@ pub fn register_eventfd(self: *IoUring, fd: posix.fd_t) !void { | ... | @@ -1247,7 +1247,7 @@ pub fn register_eventfd(self: *IoUring, fd: posix.fd_t) !void { |
| 1247 | /// an io_uring instance. Notifications are only posted for events that complete in an async manner. | 1247 | /// an io_uring instance. Notifications are only posted for events that complete in an async manner. |
| 1248 | /// This means that events that complete inline while being submitted do not trigger a notification event. | 1248 | /// This means that events that complete inline while being submitted do not trigger a notification event. |
| 1249 | /// Only a single eventfd can be registered at any given point in time. | 1249 | /// Only a single eventfd can be registered at any given point in time. |
| 1250 | pub fn register_eventfd_async(self: *IoUring, fd: posix.fd_t) !void { | 1250 | pub fn register_eventfd_async(self: *IoUring, fd: linux.fd_t) !void { |
| 1251 | assert(self.fd >= 0); | 1251 | assert(self.fd >= 0); |
| 1252 | const res = linux.io_uring_register( | 1252 | const res = linux.io_uring_register( |
| 1253 | self.fd, | 1253 | self.fd, |
| ... | @@ -1405,7 +1405,7 @@ pub fn socket_direct_alloc( | ... | @@ -1405,7 +1405,7 @@ pub fn socket_direct_alloc( |
| 1405 | pub fn bind( | 1405 | pub fn bind( |
| 1406 | self: *IoUring, | 1406 | self: *IoUring, |
| 1407 | user_data: u64, | 1407 | user_data: u64, |
| 1408 | fd: posix.fd_t, | 1408 | fd: linux.fd_t, |
| 1409 | addr: *const posix.sockaddr, | 1409 | addr: *const posix.sockaddr, |
| 1410 | addrlen: posix.socklen_t, | 1410 | addrlen: posix.socklen_t, |
| 1411 | flags: u32, | 1411 | flags: u32, |
| ... | @@ -1422,7 +1422,7 @@ pub fn bind( | ... | @@ -1422,7 +1422,7 @@ pub fn bind( |
| 1422 | pub fn listen( | 1422 | pub fn listen( |
| 1423 | self: *IoUring, | 1423 | self: *IoUring, |
| 1424 | user_data: u64, | 1424 | user_data: u64, |
| 1425 | fd: posix.fd_t, | 1425 | fd: linux.fd_t, |
| 1426 | backlog: usize, | 1426 | backlog: usize, |
| 1427 | flags: u32, | 1427 | flags: u32, |
| 1428 | ) !*linux.io_uring_sqe { | 1428 | ) !*linux.io_uring_sqe { |
| ... | @@ -1513,7 +1513,7 @@ pub const SubmissionQueue = struct { | ... | @@ -1513,7 +1513,7 @@ pub const SubmissionQueue = struct { |
| 1513 | sqe_head: u32 = 0, | 1513 | sqe_head: u32 = 0, |
| 1514 | sqe_tail: u32 = 0, | 1514 | sqe_tail: u32 = 0, |
| 1515 | | 1515 | |
| 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 { |
| 1517 | assert(fd >= 0); | 1517 | assert(fd >= 0); |
| 1518 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); | 1518 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); |
| 1519 | const size = @max( | 1519 | const size = @max( |
| ... | @@ -1576,7 +1576,7 @@ pub const CompletionQueue = struct { | ... | @@ -1576,7 +1576,7 @@ pub const CompletionQueue = struct { |
| 1576 | overflow: *u32, | 1576 | overflow: *u32, |
| 1577 | cqes: []linux.io_uring_cqe, | 1577 | cqes: []linux.io_uring_cqe, |
| 1578 | | 1578 | |
| 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 { |
| 1580 | assert(fd >= 0); | 1580 | assert(fd >= 0); |
| 1581 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); | 1581 | assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); |
| 1582 | const mmap = sq.mmap; | 1582 | const mmap = sq.mmap; |
| ... | @@ -1677,7 +1677,7 @@ pub const BufferGroup = struct { | ... | @@ -1677,7 +1677,7 @@ pub const BufferGroup = struct { |
| 1677 | } | 1677 | } |
| 1678 | | 1678 | |
| 1679 | // Prepare recv operation which will select buffer from this group. | 1679 | // 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 { |
| 1681 | var sqe = try self.ring.get_sqe(); | 1681 | var sqe = try self.ring.get_sqe(); |
| 1682 | sqe.prep_rw(.RECV, fd, 0, 0, 0); | 1682 | sqe.prep_rw(.RECV, fd, 0, 0, 0); |
| 1683 | sqe.rw_flags = flags; | 1683 | sqe.rw_flags = flags; |
| ... | @@ -1688,7 +1688,7 @@ pub const BufferGroup = struct { | ... | @@ -1688,7 +1688,7 @@ pub const BufferGroup = struct { |
| 1688 | } | 1688 | } |
| 1689 | | 1689 | |
| 1690 | // Prepare multishot recv operation which will select buffer from this group. | 1690 | // 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 { |
| 1692 | var sqe = try self.recv(user_data, fd, flags); | 1692 | var sqe = try self.recv(user_data, fd, flags); |
| 1693 | sqe.ioprio |= linux.IORING_RECV_MULTISHOT; | 1693 | sqe.ioprio |= linux.IORING_RECV_MULTISHOT; |
| 1694 | return sqe; | 1694 | return sqe; |
| ... | @@ -1732,7 +1732,7 @@ pub const BufferGroup = struct { | ... | @@ -1732,7 +1732,7 @@ pub const BufferGroup = struct { |
| 1732 | /// `entries` is the number of entries requested in the buffer ring, must be power of 2. | 1732 | /// `entries` is the number of entries requested in the buffer ring, must be power of 2. |
| 1733 | /// `group_id` is the chosen buffer group ID, unique in IO_Uring. | 1733 | /// `group_id` is the chosen buffer group ID, unique in IO_Uring. |
| 1734 | pub fn setup_buf_ring( | 1734 | pub fn setup_buf_ring( |
| 1735 | fd: posix.fd_t, | 1735 | fd: linux.fd_t, |
| 1736 | entries: u16, | 1736 | entries: u16, |
| 1737 | group_id: u16, | 1737 | group_id: u16, |
| 1738 | flags: linux.io_uring_buf_reg.Flags, | 1738 | flags: linux.io_uring_buf_reg.Flags, |
| ... | @@ -1758,7 +1758,7 @@ pub fn setup_buf_ring( | ... | @@ -1758,7 +1758,7 @@ pub fn setup_buf_ring( |
| 1758 | } | 1758 | } |
| 1759 | | 1759 | |
| 1760 | fn register_buf_ring( | 1760 | fn register_buf_ring( |
| 1761 | fd: posix.fd_t, | 1761 | fd: linux.fd_t, |
| 1762 | addr: u64, | 1762 | addr: u64, |
| 1763 | entries: u32, | 1763 | entries: u32, |
| 1764 | group_id: u16, | 1764 | group_id: u16, |
| ... | @@ -1780,7 +1780,7 @@ fn register_buf_ring( | ... | @@ -1780,7 +1780,7 @@ fn register_buf_ring( |
| 1780 | try handle_register_buf_ring_result(res); | 1780 | try handle_register_buf_ring_result(res); |
| 1781 | } | 1781 | } |
| 1782 | | 1782 | |
| 1783 | fn unregister_buf_ring(fd: posix.fd_t, group_id: u16) !void { | 1783 | fn unregister_buf_ring(fd: linux.fd_t, group_id: u16) !void { |
| 1784 | var reg = mem.zeroInit(linux.io_uring_buf_reg, .{ | 1784 | var reg = mem.zeroInit(linux.io_uring_buf_reg, .{ |
| 1785 | .bgid = group_id, | 1785 | .bgid = group_id, |
| 1786 | }); | 1786 | }); |
| ... | @@ -1802,7 +1802,7 @@ fn handle_register_buf_ring_result(res: usize) !void { | ... | @@ -1802,7 +1802,7 @@ fn handle_register_buf_ring_result(res: usize) !void { |
| 1802 | } | 1802 | } |
| 1803 | | 1803 | |
| 1804 | // Unregisters a previously registered shared buffer ring, returned from io_uring_setup_buf_ring. | 1804 | // Unregisters a previously registered shared buffer ring, returned from io_uring_setup_buf_ring. |
| 1805 | pub fn free_buf_ring(fd: posix.fd_t, br: *align(page_size_min) linux.io_uring_buf_ring, entries: u32, group_id: u16) void { | 1805 | pub fn free_buf_ring(fd: linux.fd_t, br: *align(page_size_min) linux.io_uring_buf_ring, entries: u32, group_id: u16) void { |
| 1806 | unregister_buf_ring(fd, group_id) catch {}; | 1806 | unregister_buf_ring(fd, group_id) catch {}; |
| 1807 | var mmap: []align(page_size_min) u8 = undefined; | 1807 | var mmap: []align(page_size_min) u8 = undefined; |
| 1808 | mmap.ptr = @ptrCast(br); | 1808 | mmap.ptr = @ptrCast(br); |
| ... | @@ -1873,7 +1873,7 @@ test "nop" { | ... | @@ -1873,7 +1873,7 @@ test "nop" { |
| 1873 | }; | 1873 | }; |
| 1874 | defer { | 1874 | defer { |
| 1875 | ring.deinit(); | 1875 | 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"); |
| 1877 | } | 1877 | } |
| 1878 | | 1878 | |
| 1879 | const sqe = try ring.nop(0xaaaaaaaa); | 1879 | const sqe = try ring.nop(0xaaaaaaaa); |
| ... | @@ -1949,7 +1949,7 @@ test "readv" { | ... | @@ -1949,7 +1949,7 @@ test "readv" { |
| 1949 | // https://github.com/torvalds/linux/blob/v5.4/fs/io_uring.c#L3119-L3124 vs | 1949 | // https://github.com/torvalds/linux/blob/v5.4/fs/io_uring.c#L3119-L3124 vs |
| 1950 | // https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L6687-L6691 | 1950 | // https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L6687-L6691 |
| 1951 | // We therefore avoid stressing sparse fd sets here: | 1951 | // 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; |
| 1953 | const fd_index = 0; | 1953 | const fd_index = 0; |
| 1954 | registered_fds[fd_index] = fd; | 1954 | registered_fds[fd_index] = fd; |
| 1955 | try ring.register_files(registered_fds[0..]); | 1955 | try ring.register_files(registered_fds[0..]); |
| ... | @@ -2383,7 +2383,7 @@ test "sendmsg/recvmsg" { | ... | @@ -2383,7 +2383,7 @@ test "sendmsg/recvmsg" { |
| 2383 | const iovecs_send = [_]posix.iovec_const{ | 2383 | const iovecs_send = [_]posix.iovec_const{ |
| 2384 | posix.iovec_const{ .base = &buffer_send, .len = buffer_send.len }, | 2384 | posix.iovec_const{ .base = &buffer_send, .len = buffer_send.len }, |
| 2385 | }; | 2385 | }; |
| 2386 | const msg_send: posix.msghdr_const = .{ | 2386 | const msg_send: linux.msghdr_const = .{ |
| 2387 | .name = addrAny(&address_server), | 2387 | .name = addrAny(&address_server), |
| 2388 | .namelen = @sizeOf(linux.sockaddr.in), | 2388 | .namelen = @sizeOf(linux.sockaddr.in), |
| 2389 | .iov = &iovecs_send, | 2389 | .iov = &iovecs_send, |
| ... | @@ -2405,7 +2405,7 @@ test "sendmsg/recvmsg" { | ... | @@ -2405,7 +2405,7 @@ test "sendmsg/recvmsg" { |
| 2405 | .port = 0, | 2405 | .port = 0, |
| 2406 | .addr = 0, | 2406 | .addr = 0, |
| 2407 | }; | 2407 | }; |
| 2408 | var msg_recv: posix.msghdr = .{ | 2408 | var msg_recv: linux.msghdr = .{ |
| 2409 | .name = addrAny(&address_recv), | 2409 | .name = addrAny(&address_recv), |
| 2410 | .namelen = @sizeOf(linux.sockaddr.in), | 2410 | .namelen = @sizeOf(linux.sockaddr.in), |
| 2411 | .iov = &iovecs_recv, | 2411 | .iov = &iovecs_recv, |
| ... | @@ -2785,7 +2785,7 @@ test "register_files_update" { | ... | @@ -2785,7 +2785,7 @@ test "register_files_update" { |
| 2785 | const fd = try posix.openZ("/dev/zero", .{ .ACCMODE = .RDONLY, .CLOEXEC = true }, 0); | 2785 | const fd = try posix.openZ("/dev/zero", .{ .ACCMODE = .RDONLY, .CLOEXEC = true }, 0); |
| 2786 | defer posix.close(fd); | 2786 | defer posix.close(fd); |
| 2787 | | 2787 | |
| 2788 | var registered_fds = [_]posix.fd_t{0} ** 2; | 2788 | var registered_fds = [_]linux.fd_t{0} ** 2; |
| 2789 | const fd_index = 0; | 2789 | const fd_index = 0; |
| 2790 | const fd_index2 = 1; | 2790 | const fd_index2 = 1; |
| 2791 | registered_fds[fd_index] = fd; | 2791 | registered_fds[fd_index] = fd; |
| ... | @@ -3764,7 +3764,7 @@ test "accept_direct" { | ... | @@ -3764,7 +3764,7 @@ test "accept_direct" { |
| 3764 | }; | 3764 | }; |
| 3765 | | 3765 | |
| 3766 | // register direct file descriptors | 3766 | // register direct file descriptors |
| 3767 | var registered_fds = [_]posix.fd_t{-1} ** 2; | 3767 | var registered_fds = [_]linux.fd_t{-1} ** 2; |
| 3768 | try ring.register_files(registered_fds[0..]); | 3768 | try ring.register_files(registered_fds[0..]); |
| 3769 | | 3769 | |
| 3770 | const listener_socket = try createListenerSocket(&address); | 3770 | const listener_socket = try createListenerSocket(&address); |
| ... | @@ -3847,7 +3847,7 @@ test "accept_multishot_direct" { | ... | @@ -3847,7 +3847,7 @@ test "accept_multishot_direct" { |
| 3847 | .addr = @bitCast([4]u8{ 127, 0, 0, 1 }), | 3847 | .addr = @bitCast([4]u8{ 127, 0, 0, 1 }), |
| 3848 | }; | 3848 | }; |
| 3849 | | 3849 | |
| 3850 | var registered_fds = [_]posix.fd_t{-1} ** 2; | 3850 | var registered_fds = [_]linux.fd_t{-1} ** 2; |
| 3851 | try ring.register_files(registered_fds[0..]); | 3851 | try ring.register_files(registered_fds[0..]); |
| 3852 | | 3852 | |
| 3853 | const listener_socket = try createListenerSocket(&address); | 3853 | const listener_socket = try createListenerSocket(&address); |
| ... | @@ -3910,7 +3910,7 @@ test "socket" { | ... | @@ -3910,7 +3910,7 @@ test "socket" { |
| 3910 | // test completion | 3910 | // test completion |
| 3911 | var cqe = try ring.copy_cqe(); | 3911 | var cqe = try ring.copy_cqe(); |
| 3912 | try testing.expectEqual(posix.E.SUCCESS, cqe.err()); | 3912 | 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); |
| 3914 | try testing.expect(fd > 2); | 3914 | try testing.expect(fd > 2); |
| 3915 | | 3915 | |
| 3916 | posix.close(fd); | 3916 | posix.close(fd); |
| ... | @@ -3926,7 +3926,7 @@ test "socket_direct/socket_direct_alloc/close_direct" { | ... | @@ -3926,7 +3926,7 @@ test "socket_direct/socket_direct_alloc/close_direct" { |
| 3926 | }; | 3926 | }; |
| 3927 | defer ring.deinit(); | 3927 | defer ring.deinit(); |
| 3928 | | 3928 | |
| 3929 | var registered_fds = [_]posix.fd_t{-1} ** 3; | 3929 | var registered_fds = [_]linux.fd_t{-1} ** 3; |
| 3930 | try ring.register_files(registered_fds[0..]); | 3930 | try ring.register_files(registered_fds[0..]); |
| 3931 | | 3931 | |
| 3932 | // create socket in registered file descriptor at index 0 (last param) | 3932 | // create socket in registered file descriptor at index 0 (last param) |
| ... | @@ -4007,7 +4007,7 @@ test "openat_direct/close_direct" { | ... | @@ -4007,7 +4007,7 @@ test "openat_direct/close_direct" { |
| 4007 | }; | 4007 | }; |
| 4008 | defer ring.deinit(); | 4008 | defer ring.deinit(); |
| 4009 | | 4009 | |
| 4010 | var registered_fds = [_]posix.fd_t{-1} ** 3; | 4010 | var registered_fds = [_]linux.fd_t{-1} ** 3; |
| 4011 | try ring.register_files(registered_fds[0..]); | 4011 | try ring.register_files(registered_fds[0..]); |
| 4012 | | 4012 | |
| 4013 | var tmp = std.testing.tmpDir(.{}); | 4013 | var tmp = std.testing.tmpDir(.{}); |
| ... | @@ -4394,7 +4394,7 @@ test "ring mapped buffers multishot recv" { | ... | @@ -4394,7 +4394,7 @@ test "ring mapped buffers multishot recv" { |
| 4394 | fn buf_grp_recv_submit_get_cqe( | 4394 | fn buf_grp_recv_submit_get_cqe( |
| 4395 | ring: *IoUring, | 4395 | ring: *IoUring, |
| 4396 | buf_grp: *BufferGroup, | 4396 | buf_grp: *BufferGroup, |
| 4397 | fd: posix.fd_t, | 4397 | fd: linux.fd_t, |
| 4398 | user_data: u64, | 4398 | user_data: u64, |
| 4399 | ) !linux.io_uring_cqe { | 4399 | ) !linux.io_uring_cqe { |
| 4400 | // prepare and submit recv | 4400 | // prepare and submit recv |
| ... | @@ -4507,7 +4507,7 @@ test "bind/listen/connect" { | ... | @@ -4507,7 +4507,7 @@ test "bind/listen/connect" { |
| 4507 | var cqe = try ring.copy_cqe(); | 4507 | var cqe = try ring.copy_cqe(); |
| 4508 | try testing.expectEqual(1, cqe.user_data); | 4508 | try testing.expectEqual(1, cqe.user_data); |
| 4509 | try testing.expectEqual(posix.E.SUCCESS, cqe.err()); | 4509 | 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); |
| 4511 | try testing.expect(listen_fd > 2); | 4511 | try testing.expect(listen_fd > 2); |
| 4512 | | 4512 | |
| 4513 | // Prepare: set socket option * 2, bind, listen | 4513 | // Prepare: set socket option * 2, bind, listen |
| ... | @@ -4549,7 +4549,7 @@ test "bind/listen/connect" { | ... | @@ -4549,7 +4549,7 @@ test "bind/listen/connect" { |
| 4549 | try testing.expectEqual(6, cqe.user_data); | 4549 | try testing.expectEqual(6, cqe.user_data); |
| 4550 | try testing.expectEqual(posix.E.SUCCESS, cqe.err()); | 4550 | try testing.expectEqual(posix.E.SUCCESS, cqe.err()); |
| 4551 | // Get connect socket fd | 4551 | // Get connect socket fd |
| 4552 | const connect_fd: posix.fd_t = @intCast(cqe.res); | 4552 | const connect_fd: linux.fd_t = @intCast(cqe.res); |
| 4553 | try testing.expect(connect_fd > 2 and connect_fd != listen_fd); | 4553 | try testing.expect(connect_fd > 2 and connect_fd != listen_fd); |
| 4554 | break :brk connect_fd; | 4554 | break :brk connect_fd; |
| 4555 | }; | 4555 | }; |