| ... | @@ -616,6 +616,7 @@ pub const IO_Uring = struct { | ... | @@ -616,6 +616,7 @@ pub const IO_Uring = struct { |
| 616 | | 616 | |
| 617 | /// Queues (but does not submit) an SQE to perform a `recv(2)`. | 617 | /// Queues (but does not submit) an SQE to perform a `recv(2)`. |
| 618 | /// Returns a pointer to the SQE. | 618 | /// Returns a pointer to the SQE. |
| | 619 | /// Available since 5.6 |
| 619 | pub fn recv( | 620 | pub fn recv( |
| 620 | self: *IO_Uring, | 621 | self: *IO_Uring, |
| 621 | user_data: u64, | 622 | user_data: u64, |
| ... | @@ -639,6 +640,7 @@ pub const IO_Uring = struct { | ... | @@ -639,6 +640,7 @@ pub const IO_Uring = struct { |
| 639 | | 640 | |
| 640 | /// Queues (but does not submit) an SQE to perform a `send(2)`. | 641 | /// Queues (but does not submit) an SQE to perform a `send(2)`. |
| 641 | /// Returns a pointer to the SQE. | 642 | /// Returns a pointer to the SQE. |
| | 643 | /// Available since 5.6 |
| 642 | pub fn send( | 644 | pub fn send( |
| 643 | self: *IO_Uring, | 645 | self: *IO_Uring, |
| 644 | user_data: u64, | 646 | user_data: u64, |
| ... | @@ -654,6 +656,7 @@ pub const IO_Uring = struct { | ... | @@ -654,6 +656,7 @@ pub const IO_Uring = struct { |
| 654 | | 656 | |
| 655 | /// Queues (but does not submit) an SQE to perform an async zerocopy `send(2)`. | 657 | /// Queues (but does not submit) an SQE to perform an async zerocopy `send(2)`. |
| 656 | /// Returns a pointer to the SQE. | 658 | /// Returns a pointer to the SQE. |
| | 659 | /// Available since 6.0 |
| 657 | pub fn send_zc( | 660 | pub fn send_zc( |
| 658 | self: *IO_Uring, | 661 | self: *IO_Uring, |
| 659 | user_data: u64, | 662 | user_data: u64, |
| ... | @@ -670,6 +673,7 @@ pub const IO_Uring = struct { | ... | @@ -670,6 +673,7 @@ pub const IO_Uring = struct { |
| 670 | | 673 | |
| 671 | /// Queues (but does not submit) an SQE to perform an async zerocopy `send(2)`. | 674 | /// Queues (but does not submit) an SQE to perform an async zerocopy `send(2)`. |
| 672 | /// Returns a pointer to the SQE. | 675 | /// Returns a pointer to the SQE. |
| | 676 | /// Available since 6.0 |
| 673 | pub fn send_zc_fixed( | 677 | pub fn send_zc_fixed( |
| 674 | self: *IO_Uring, | 678 | self: *IO_Uring, |
| 675 | user_data: u64, | 679 | user_data: u64, |
| ... | @@ -687,6 +691,7 @@ pub const IO_Uring = struct { | ... | @@ -687,6 +691,7 @@ pub const IO_Uring = struct { |
| 687 | | 691 | |
| 688 | /// Queues (but does not submit) an SQE to perform a `recvmsg(2)`. | 692 | /// Queues (but does not submit) an SQE to perform a `recvmsg(2)`. |
| 689 | /// Returns a pointer to the SQE. | 693 | /// Returns a pointer to the SQE. |
| | 694 | /// Available since 5.3 |
| 690 | pub fn recvmsg( | 695 | pub fn recvmsg( |
| 691 | self: *IO_Uring, | 696 | self: *IO_Uring, |
| 692 | user_data: u64, | 697 | user_data: u64, |
| ... | @@ -702,6 +707,7 @@ pub const IO_Uring = struct { | ... | @@ -702,6 +707,7 @@ pub const IO_Uring = struct { |
| 702 | | 707 | |
| 703 | /// Queues (but does not submit) an SQE to perform a `sendmsg(2)`. | 708 | /// Queues (but does not submit) an SQE to perform a `sendmsg(2)`. |
| 704 | /// Returns a pointer to the SQE. | 709 | /// Returns a pointer to the SQE. |
| | 710 | /// Available since 5.3 |
| 705 | pub fn sendmsg( | 711 | pub fn sendmsg( |
| 706 | self: *IO_Uring, | 712 | self: *IO_Uring, |
| 707 | user_data: u64, | 713 | user_data: u64, |
| ... | @@ -717,6 +723,7 @@ pub const IO_Uring = struct { | ... | @@ -717,6 +723,7 @@ pub const IO_Uring = struct { |
| 717 | | 723 | |
| 718 | /// Queues (but does not submit) an SQE to perform an async zerocopy `sendmsg(2)`. | 724 | /// Queues (but does not submit) an SQE to perform an async zerocopy `sendmsg(2)`. |
| 719 | /// Returns a pointer to the SQE. | 725 | /// Returns a pointer to the SQE. |
| | 726 | /// Available since 6.1 |
| 720 | pub fn sendmsg_zc( | 727 | pub fn sendmsg_zc( |
| 721 | self: *IO_Uring, | 728 | self: *IO_Uring, |
| 722 | user_data: u64, | 729 | user_data: u64, |
| ... | @@ -3783,13 +3790,9 @@ test "accept multishot" { | ... | @@ -3783,13 +3790,9 @@ test "accept multishot" { |
| 3783 | } | 3790 | } |
| 3784 | | 3791 | |
| 3785 | test "accept/connect/send_zc/recv" { | 3792 | test "accept/connect/send_zc/recv" { |
| 3786 | if (builtin.os.tag != .linux) return error.SkipZigTest; | 3793 | try skipKernelLessThan(.{ .major = 6, .minor = 0, .patch = 0 }); |
| 3787 | | 3794 | |
| 3788 | var ring = IO_Uring.init(16, 0) catch |err| switch (err) { | 3795 | var ring = try IO_Uring.init(16, 0); |
| 3789 | error.SystemOutdated => return error.SkipZigTest, | | |
| 3790 | error.PermissionDenied => return error.SkipZigTest, | | |
| 3791 | else => return err, | | |
| 3792 | }; | | |
| 3793 | defer ring.deinit(); | 3796 | defer ring.deinit(); |
| 3794 | | 3797 | |
| 3795 | const socket_test_harness = try createSocketTestHarness(&ring); | 3798 | const socket_test_harness = try createSocketTestHarness(&ring); |
| ... | @@ -3811,7 +3814,6 @@ test "accept/connect/send_zc/recv" { | ... | @@ -3811,7 +3814,6 @@ test "accept/connect/send_zc/recv" { |
| 3811 | // request, with the user_data field set to the same value. | 3814 | // request, with the user_data field set to the same value. |
| 3812 | // buffer_send must be keep alive until second cqe. | 3815 | // buffer_send must be keep alive until second cqe. |
| 3813 | var cqe_send = try ring.copy_cqe(); | 3816 | var cqe_send = try ring.copy_cqe(); |
| 3814 | if (cqe_send.err() == .INVAL) return error.SkipZigTest; | | |
| 3815 | try testing.expectEqual(linux.io_uring_cqe{ | 3817 | try testing.expectEqual(linux.io_uring_cqe{ |
| 3816 | .user_data = 0xeeeeeeee, | 3818 | .user_data = 0xeeeeeeee, |
| 3817 | .res = buffer_send.len, | 3819 | .res = buffer_send.len, |
| ... | @@ -3819,7 +3821,6 @@ test "accept/connect/send_zc/recv" { | ... | @@ -3819,7 +3821,6 @@ test "accept/connect/send_zc/recv" { |
| 3819 | }, cqe_send); | 3821 | }, cqe_send); |
| 3820 | | 3822 | |
| 3821 | const cqe_recv = try ring.copy_cqe(); | 3823 | const cqe_recv = try ring.copy_cqe(); |
| 3822 | if (cqe_recv.err() == .INVAL) return error.SkipZigTest; | | |
| 3823 | try testing.expectEqual(linux.io_uring_cqe{ | 3824 | try testing.expectEqual(linux.io_uring_cqe{ |
| 3824 | .user_data = 0xffffffff, | 3825 | .user_data = 0xffffffff, |
| 3825 | .res = buffer_recv.len, | 3826 | .res = buffer_recv.len, |
| ... | @@ -3831,7 +3832,6 @@ test "accept/connect/send_zc/recv" { | ... | @@ -3831,7 +3832,6 @@ test "accept/connect/send_zc/recv" { |
| 3831 | // Second completion of zero-copy send. | 3832 | // Second completion of zero-copy send. |
| 3832 | // IORING_CQE_F_NOTIF in flags signals that kernel is done with send_buffer | 3833 | // IORING_CQE_F_NOTIF in flags signals that kernel is done with send_buffer |
| 3833 | cqe_send = try ring.copy_cqe(); | 3834 | cqe_send = try ring.copy_cqe(); |
| 3834 | if (cqe_send.err() == .INVAL) return error.SkipZigTest; | | |
| 3835 | try testing.expectEqual(linux.io_uring_cqe{ | 3835 | try testing.expectEqual(linux.io_uring_cqe{ |
| 3836 | .user_data = 0xeeeeeeee, | 3836 | .user_data = 0xeeeeeeee, |
| 3837 | .res = 0, | 3837 | .res = 0, |