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 iovec, it
49 is more efficient to use io_uring_prep_write(3) rather than this func‐
50 tion, as no state has to be maintained for a non-vectored IO request.
51 As with any request that passes in data in a struct, that data must re‐
52 main valid until the request has been successfully submitted. It need
53 not remain valid until completion. Once a request has been submitted,
54 the in-kernel state is stable. Very early kernels (5.4 and earlier) re‐
55 quired state to be stable until the completion occurred. Applications
56 can test for this behavior by inspecting the IORING_FEAT_SUBMIT_STABLE
57 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)