Function splice [src]

Queues (but does not submit) an SQE to perform a splice(2) Either fd_in or fd_out must be a pipe. If fd_in refers to a pipe, off_in is ignored and must be set to std.math.maxInt(u64). If fd_in does not refer to a pipe and off_in is maxInt(u64), then len are read from fd_in starting from the file offset, which is incremented by the number of bytes read. If fd_in does not refer to a pipe and off_in is not maxInt(u64), then the starting offset of fd_in will be off_in. This splice operation can be used to implement sendfile by splicing to an intermediate pipe first, then splice to the final destination. In fact, the implementation of sendfile in kernel uses splice internally. NOTE that even if fd_in or fd_out refers to a pipe, the splice operation can still fail with EINVAL if one of the fd doesn't explicitly support splice peration, e.g. reading from terminal is unsupported from kernel 5.7 to 5.11. See https://github.com/axboe/liburing/issues/291 Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.

Prototype

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

Parameters

self: *IoUringuser_data: u64fd_in: posix.fd_toff_in: u64fd_out: posix.fd_toff_out: u64len: usize

Source

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 { const sqe = try self.get_sqe(); sqe.prep_splice(fd_in, off_in, fd_out, off_out, len); sqe.user_data = user_data; return sqe; }