prepSplice

Note: Available from Linux 5.7

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 operation, e.g. reading from terminal is unsupported from kernel 5.7 to 5.11. Check issue #291 for more information.

Either fd_in or fd_out must be a pipe.

Params fd_in = input file descriptor off_in = If fd_in refers to a pipe, off_in must be -1. If fd_in does not refer to a pipe and off_in is -1, then bytes are read from fd_in starting from the file offset and it is adjust appropriately; If fd_in does not refer to a pipe and off_in is not -1, then the starting offset of fd_in will be off_in. fd_out = output filedescriptor off_out = The description of off_in also applied to off_out. len = Up to len bytes would be transfered between file descriptors. splice_flags = see man splice(2) for description of flags.

version(linux)
nothrow @nogc ref @safe
SubmissionEntry
prepSplice
(
return ref SubmissionEntry entry
,
int fd_in
,
ulong off_in
,
int fd_out
,
ulong off_out
,
uint len
,)

Meta