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 2017-09-15 "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 is an internal field used by the kernel.
63 Do not modify this field after an
68 This is an internal field used by the kernel.
69 Do not modify this field after an
74 This defines the R/W flags passed with structure.
78 .BR RWF_APPEND " (since Linux 4.16)"
79 .\" commit e1fc742e14e01d84d9693c4aca4ab23da65811fb
80 Append data to the end of the file.
81 See the description of the flag of the same name in
83 as well as the description of
90 The file offset is not changed.
92 .BR RWF_DSYNC " (since Linux 4.7)"
93 Write operation complete according to requirement of
94 synchronized I/O data integrity.
95 See the description of the flag of the same name in
97 as well the description of
102 .BR RWF_HIPRI " (since Linux 4.6)"
103 High priority request, poll if possible
105 .BR RWF_NOWAIT " (since Linux 4.14)"
106 Don't wait if the I/O will block for operations such as
107 file block allocations, dirty page flush, mutex locks,
108 or a congested block device inside the kernel.
109 If any of these conditions are met, the control block is returned
110 immediately with a return value of
117 .BR io_getevents (2)).
119 .BR RWF_SYNC " (since Linux 4.7)"
120 Write operation complete according to requirement of
121 synchronized I/O file integrity.
122 See the description of the flag of the same name in
124 as well the description of
131 This defines the type of I/O to be performed by the iocb structure.
133 valid values are defined by the enum defined in
134 .IR linux/aio_abi.h :
145 IOCB_CMD_PWRITEV = 8,
151 This defines the requests priority.
154 The file descriptor on which the I/O operation is to be performed.
157 This is the buffer used to transfer data for a read or write operation.
160 This is the size of the buffer pointed to by
164 This is the file offset at which the I/O operation is to be performed.
167 This is the flag to be passed iocb structure.
168 The only valid value is
169 .BR IOCB_FLAG_RESFD ,
170 which indicates that the asynchronous I/O control must signal the file
171 descriptor mentioned in
176 The file descriptor to signal in the event of asynchronous I/O completion.
180 returns the number of \fIiocb\fPs submitted (which may be
181 less than \fInr\fP, or 0 if \fInr\fP is zero).
182 For the failure return, see NOTES.
186 Insufficient resources are available to queue any \fIiocb\fPs.
189 The file descriptor specified in the first \fIiocb\fP is invalid.
192 One of the data structures points to invalid data.
195 The AIO context specified by \fIctx_id\fP is invalid.
196 \fInr\fP is less than 0.
199 is not properly initialized,
200 or the operation specified is invalid for the file descriptor
205 is not implemented on this architecture.
208 The asynchronous I/O system calls first appeared in Linux 2.5.
212 is Linux-specific and should not be used in
213 programs that are intended to be portable.
215 Glibc does not provide a wrapper function for this system call.
216 You could invoke it using
218 But instead, you probably want to use the
220 wrapper function provided by
221 .\" http://git.fedorahosted.org/git/?p=libaio.git
226 wrapper function uses a different type
228 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
235 wrapper does not follow the usual C library conventions for indicating errors:
236 on error it returns a negated error number
237 (the negative of one of the values listed in ERRORS).
238 If the system call is invoked via
240 then the return value follows the usual conventions for
241 indicating an error: \-1, with
243 set to a (positive) value that indicates the error.
247 .BR io_getevents (2),