1io_uring_prep_splice(3) liburing Manual io_uring_prep_splice(3)
2
3
4
6 io_uring_prep_splice - prepare an splice request
7
9 #include <fcntl.h>
10 #include <liburing.h>
11
12 void io_uring_prep_splice(struct io_uring_sqe *sqe,
13 int fd_in,
14 int64_t off_in,
15 int fd_out,
16 int64_t off_out,
17 unsigned int nbytes,
18 unsigned int splice_flags);
19
21 The io_uring_prep_splice(3) function prepares a splice request. The
22 submission queue entry sqe is setup to use as input the file descriptor
23 fd_in at offset off_in, splicing data to the file descriptor at fd_out
24 and at offset off_out. nbytes bytes of data should be spliced between
25 the two descriptors. splice_flags are modifier flags for the opera‐
26 tion. See splice(2) for the generic splice flags.
27
28 If the fd_out descriptor, IOSQE_FIXED_FILE can be set in the SQE to in‐
29 dicate that. For the input file, the io_uring specific
30 SPLICE_F_FD_IN_FIXED can be set in splice_flags and fd_in given as a
31 registered file descriptor offset.
32
33 If fd_in refers to a pipe, off_in is ignored and must be set to -1.
34
35 If fd_in does not refer to a pipe and off_in is -1, then nbytes are
36 read from fd_in starting from the file offset, which is incremented by
37 the number of bytes read.
38
39 If fd_in does not refer to a pipe and off_in is not -1, then the start‐
40 ing offset of fd_in will be off_in.
41
42 The same rules apply to fd_out and off_out.
43
44 This function prepares an async splice(2) request. See that man page
45 for details.
46
47
49 None
50
52 The CQE res field will contain the result of the operation. See the re‐
53 lated man page for details on possible values. Note that where synchro‐
54 nous system calls will return -1 on failure and set errno to the actual
55 error value, io_uring never uses errno. Instead it returns the negated
56 errno directly in the CQE res field.
57
59 io_uring_get_sqe(3), io_uring_submit(3), io_uring_register(2),
60 splice(2)
61
62
64 Note that even if fd_in or fd_out refers to a pipe, the splice opera‐
65 tion can still fail with EINVAL if one of the fd doesn't explicitly
66 support splice operation, e.g. reading from terminal is unsupported
67 from kernel 5.7 to 5.11.
68
69
70
71liburing-2.2 March 13, 2022 io_uring_prep_splice(3)