diff --git a/io-uring-test/src/tests/net.rs b/io-uring-test/src/tests/net.rs index 60d7731..116ac96 100644 --- a/io-uring-test/src/tests/net.rs +++ b/io-uring-test/src/tests/net.rs @@ -1662,10 +1662,12 @@ pub fn test_udp_sendzc_with_dest // First SendZc notification 11 => { assert!(cqueue::more(cqe.flags())); + assert!(!cqueue::notif(cqe.flags())); } // Last SendZc notification 0 => { assert!(!cqueue::more(cqe.flags())); + assert!(cqueue::notif(cqe.flags())); } _ => panic!("wrong result for notification"), }, diff --git a/src/cqueue.rs b/src/cqueue.rs index 2bf3595..a235af7 100644 --- a/src/cqueue.rs +++ b/src/cqueue.rs @@ -333,3 +333,11 @@ pub fn more(flags: u32) -> bool { pub fn sock_nonempty(flags: u32) -> bool { flags & sys::IORING_CQE_F_SOCK_NONEMPTY != 0 } + +/// Returns whether this completion event is a notification. +/// +/// This corresponds to the `IORING_CQE_F_NOTIF` flag, +/// currently used by the [SendZc](crate::opcode::SendZc) operation. +pub fn notif(flags: u32) -> bool { + flags & sys::IORING_CQE_F_NOTIF != 0 +} diff --git a/src/opcode.rs b/src/opcode.rs index 7a9f3d0..3ddc8fe 100644 --- a/src/opcode.rs +++ b/src/opcode.rs @@ -1662,6 +1662,12 @@ opcode! { /// /// A fixed (pre-mapped) buffer can optionally be used from pre-mapped buffers that have been /// previously registered with [`Submitter::register_buffers`](crate::Submitter::register_buffers). + /// + /// This operation might result in two completion queue entries. + /// See the `IORING_OP_SEND_ZC` section at [io_uring_enter][] for the exact semantics. + /// Notifications posted by this operation can be checked with [notif](crate::cqueue::notif). + /// + /// [io_uring_enter]: https://man7.org/linux/man-pages/man2/io_uring_enter.2.html pub struct SendZc { fd: { impl sealed::UseFixed }, buf: { *const u8 },