Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

splice

Public Function
std.os.linux.IoUring.splice
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

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.

Params

  • self: *IoUring
  • user_data: u64
  • fd_in: linux.fd_t
  • off_in: u64
  • fd_out: linux.fd_t
  • off_out: u64
  • len: usize

File

os/linux/IoUring.zig:443
443
444
445
446
447
448
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 {
    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;
}