1io_uring_prep_writev(3) liburing Manual io_uring_prep_writev(3)
2
3
4
6 io_uring_prep_writev - prepare vector I/O write request
7
9 #include <sys/uio.h>
10 #include <liburing.h>
11
12 void io_uring_prep_writev(struct io_uring_sqe *sqe,
13 int fd,
14 const struct iovec *iovecs,
15 unsigned nr_vecs,
16 __u64 offset);
17
19 The io_uring_prep_writev(3) prepares a vectored IO write request. The
20 submission queue entry sqe is setup to use the file descriptor fd to
21 start writing nr_vecs from the iovecs array at the specified offset.
22
23 On files that support seeking, if the offset is set to -1, the write
24 operation commences at the file offset, and the file offset is incre‐
25 mented by the number of bytes written. See write(2) for more details.
26 Note that for an async API, reading and updating the current file off‐
27 set may result in unpredictable behavior, unless access to the file is
28 serialized. It is not encouraged to use this feature if it's possible
29 to provide the desired IO offset from the application or library.
30
31 On files that are not capable of seeking, the offset must be 0 or -1.
32
33 After the write has been prepared it can be submitted with one of the
34 submit functions.
35
36
38 None
39
41 The CQE res field will contain the result of the operation. See the re‐
42 lated man page for details on possible values. Note that where synchro‐
43 nous system calls will return -1 on failure and set errno to the actual
44 error value, io_uring never uses errno. Instead it returns the negated
45 errno directly in the CQE res field.
46
48 Unless an application explicitly needs to pass in more than one iovec,
49 it is more efficient to use io_uring_prep_write(3) rather than this
50 function, as no state has to be maintained for a non-vectored IO re‐
51 quest. As with any request that passes in data in a struct, that data
52 must remain valid until the request has been successfully submitted. It
53 need not remain valid until completion. Once a request has been submit‐
54 ted, the in-kernel state is stable. Very early kernels (5.4 and ear‐
55 lier) required state to be stable until the completion occurred. Appli‐
56 cations can test for this behavior by inspecting the IORING_FEAT_SUB‐
57 MIT_STABLE flag passed back from io_uring_queue_init_params(3).
58
60 io_uring_get_sqe(3), io_uring_prep_write(3), io_uring_prep_writev2(3),
61 io_uring_submit(3)
62
63
64
65liburing-2.1 November 15, 2021 io_uring_prep_writev(3)