aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Anić <igor.anic@gmail.com>2023-11-10 16:44:18 +0100
committerIgor Anić <igor.anic@gmail.com>2023-11-10 16:44:18 +0100
commit087ee497d430d30bd9c7a2cdfdfc3d2654d105d3 (patch)
treebfd7bf5d00f66d3e2803efd1ebbfd7bf2bc8154c /src
parent6b9f7e26c9e43700225b7c2479305015df75a2b9 (diff)
downloadzig-087ee497d430d30bd9c7a2cdfdfc3d2654d105d3.tar.gz
zig-087ee497d430d30bd9c7a2cdfdfc3d2654d105d3.zip
io_uring: add zero-copy send operation
`send_zc` tries to avoid making intermediate copies of data. Zerocopy execution is not guaranteed and may fall back to copying. The flags field of the first struct io_uring_cqe may likely contain IORING_CQE_F_MORE , which means that there will be a second completion event / notification for the request, with the user_data field set to the same value. The user must not modify the data buffer until the notification is posted. The first cqe follows the usual rules and so its res field will contain the number of bytes sent or a negative error code. The notification's res field will be set to zero and the flags field will contain IORING_CQE_F_NOTIF. The two step model is needed because the kernel may hold on to buffers for a long time, e.g. waiting for a TCP ACK, and having a separate cqe for request completions allows userspace to push more data without extra delays. Note, notifications are only responsible for controlling the lifetime of the buffers, and as such don't mean anything about whether the data has atually been sent out or received by the other end. Even errored requests may generate a notification, and the user must check for IORING_CQE_F_MORE rather than relying on the result. Available since kernel 6.0. References: https://man7.org/linux/man-pages/man3/io_uring_prep_send_zc.3.html https://man7.org/linux/man-pages/man2/io_uring_enter.2.html
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions