1io_uring_prep_readv(3) liburing Manual io_uring_prep_readv(3)
2
3
4
6 io_uring_prep_readv - prepare vector I/O read request
7
9 #include <sys/uio.h>
10 #include <liburing.h>
11
12 void io_uring_prep_readv(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_readv(3) prepares a vectored IO read request. The
20 submission queue entry sqe is setup to use the file descriptor fd to
21 start reading nr_vecs into the iovecs array at the specified offset.
22
23 On files that support seeking, if the offset is set to -1, the read op‐
24 eration commences at the file offset, and the file offset is incre‐
25 mented by the number of bytes read. See read(2) for more details. Note
26 that for an async API, reading and updating the current file offset may
27 result in unpredictable behavior, unless access to the file is serial‐
28 ized. It is not encouraged to use this feature, if it's possible to
29 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_read(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_read(3), io_uring_prep_readv2(3),
61 io_uring_submit(3)
62
63
64
65liburing-2.1 November 15, 2021 io_uring_prep_readv(3)