1 .\" Copyright (C) 2003 Free Software Foundation, Inc.
2 .\" and Copyright (C) 2017 Goldwyn Rodrigues <rgoldwyn@suse.de>
4 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
5 .\" This file is distributed according to the GNU General Public License.
8 .TH IO_SUBMIT 2 2018-04-30 "Linux" "Linux Programmer's Manual"
10 io_submit \- submit asynchronous I/O blocks for processing
13 .BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
15 .BI "int io_submit(aio_context_t " ctx_id ", long " nr \
16 ", struct iocb **" iocbpp );
20 There is no glibc wrapper for this system call; see NOTES.
26 queues \fInr\fP I/O request blocks for processing in
27 the AIO context \fIctx_id\fP.
30 argument should be an array of \fInr\fP AIO control blocks,
31 which will be submitted to context \fIctx_id\fP.
35 (I/O control block) structure defined in
37 defines the parameters that control the I/O operation.
41 #include <linux/aio_abi.h>
45 __u32 PADDED(aio_key, aio_rw_flags);
59 The fields of this structure are as follows:
62 This data is copied into the
66 structure upon I/O completion (see
67 .BR io_getevents (2)).
70 This is an internal field used by the kernel.
71 Do not modify this field after an
76 This defines the R/W flags passed with structure.
80 .BR RWF_APPEND " (since Linux 4.16)"
81 .\" commit e1fc742e14e01d84d9693c4aca4ab23da65811fb
82 Append data to the end of the file.
83 See the description of the flag of the same name in
85 as well as the description of
92 The file offset is not changed.
94 .BR RWF_DSYNC " (since Linux 4.7)"
95 Write operation complete according to requirement of
96 synchronized I/O data integrity.
97 See the description of the flag of the same name in
99 as well the description of
104 .BR RWF_HIPRI " (since Linux 4.6)"
105 High priority request, poll if possible
107 .BR RWF_NOWAIT " (since Linux 4.14)"
108 Don't wait if the I/O will block for operations such as
109 file block allocations, dirty page flush, mutex locks,
110 or a congested block device inside the kernel.
111 If any of these conditions are met, the control block is returned
112 immediately with a return value of
119 .BR io_getevents (2)).
121 .BR RWF_SYNC " (since Linux 4.7)"
122 Write operation complete according to requirement of
123 synchronized I/O file integrity.
124 See the description of the flag of the same name in
126 as well the description of
133 This defines the type of I/O to be performed by the
137 valid values are defined by the enum defined in
138 .IR linux/aio_abi.h :
149 IOCB_CMD_PWRITEV = 8,
155 This defines the requests priority.
158 The file descriptor on which the I/O operation is to be performed.
161 This is the buffer used to transfer data for a read or write operation.
164 This is the size of the buffer pointed to by
168 This is the file offset at which the I/O operation is to be performed.
171 This is the set of flags associated with the
174 The valid values are:
178 Asynchronous I/O control must signal the file
179 descriptor mentioned in
183 .BR IOCB_FLAG_IOPRIO " (since Linux 4.18)"
184 .\" commit d9a08a9e616beeccdbd0e7262b7225ffdfa49e92
194 The file descriptor to signal in the event of asynchronous I/O completion.
198 returns the number of \fIiocb\fPs submitted (which may be
199 less than \fInr\fP, or 0 if \fInr\fP is zero).
200 For the failure return, see NOTES.
204 Insufficient resources are available to queue any \fIiocb\fPs.
207 The file descriptor specified in the first \fIiocb\fP is invalid.
210 One of the data structures points to invalid data.
213 The AIO context specified by \fIctx_id\fP is invalid.
214 \fInr\fP is less than 0.
217 is not properly initialized, the operation specified is invalid for the file
218 descriptor in the \fIiocb\fP, or the value in the
224 is not implemented on this architecture.
229 field is set with the class
230 .BR IOPRIO_CLASS_RT ,
231 but the submitting context does not have the
236 The asynchronous I/O system calls first appeared in Linux 2.5.
240 is Linux-specific and should not be used in
241 programs that are intended to be portable.
243 Glibc does not provide a wrapper function for this system call.
244 You could invoke it using
246 But instead, you probably want to use the
248 wrapper function provided by
249 .\" http://git.fedorahosted.org/git/?p=libaio.git
254 wrapper function uses a different type
256 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
263 wrapper does not follow the usual C library conventions for indicating errors:
264 on error it returns a negated error number
265 (the negative of one of the values listed in ERRORS).
266 If the system call is invoked via
268 then the return value follows the usual conventions for
269 indicating an error: \-1, with
271 set to a (positive) value that indicates the error.
275 .BR io_getevents (2),