1IO_SUBMIT(2) Linux Programmer's Manual IO_SUBMIT(2)
2
3
4
6 io_submit - submit asynchronous I/O blocks for processing
7
9 #include <linux/aio_abi.h> /* Defines needed types */
10
11 int io_submit(aio_context_t ctx_id, long nr, struct iocb **iocbpp);
12
13 Note: There is no glibc wrapper for this system call; see NOTES.
14
16 Note: this page describes the raw Linux system call interface. The
17 wrapper function provided by libaio uses a different type for the
18 ctx_id argument. See NOTES.
19
20 The io_submit() system call queues nr I/O request blocks for processing
21 in the AIO context ctx_id. The iocbpp argument should be an array of
22 nr AIO control blocks, which will be submitted to context ctx_id.
23
24 The iocb (I/O control block) structure defined in linux/aio_abi.h de‐
25 fines the parameters that control the I/O operation.
26
27 #include <linux/aio_abi.h>
28
29 struct iocb {
30 __u64 aio_data;
31 __u32 PADDED(aio_key, aio_rw_flags);
32 __u16 aio_lio_opcode;
33 __s16 aio_reqprio;
34 __u32 aio_fildes;
35 __u64 aio_buf;
36 __u64 aio_nbytes;
37 __s64 aio_offset;
38 __u64 aio_reserved2;
39 __u32 aio_flags;
40 __u32 aio_resfd;
41 };
42
43 The fields of this structure are as follows:
44
45 aio_data
46 This data is copied into the data field of the io_event struc‐
47 ture upon I/O completion (see io_getevents(2)).
48
49 aio_key
50 This is an internal field used by the kernel. Do not modify
51 this field after an io_submit() call.
52
53 aio_rw_flags
54 This defines the R/W flags passed with structure. The valid
55 values are:
56
57 RWF_APPEND (since Linux 4.16)
58 Append data to the end of the file. See the description
59 of the flag of the same name in pwritev2(2) as well as
60 the description of O_APPEND in open(2). The aio_offset
61 field is ignored. The file offset is not changed.
62
63 RWF_DSYNC (since Linux 4.13)
64 Write operation complete according to requirement of syn‐
65 chronized I/O data integrity. See the description of the
66 flag of the same name in pwritev2(2) as well the descrip‐
67 tion of O_DSYNC in open(2).
68
69 RWF_HIPRI (since Linux 4.13)
70 High priority request, poll if possible
71
72 RWF_NOWAIT (since Linux 4.14)
73 Don't wait if the I/O will block for operations such as
74 file block allocations, dirty page flush, mutex locks, or
75 a congested block device inside the kernel. If any of
76 these conditions are met, the control block is returned
77 immediately with a return value of -EAGAIN in the res
78 field of the io_event structure (see io_getevents(2)).
79