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.
79 High priority request, poll if possible
82 Write operation complete according to requirement of
83 synchronized I/O data integrity.
84 See the description of the flag of the same name in
86 as well the description of
92 Write operation complete according to requirement of
93 synchronized I/O file integrity.
94 See the description of the flag of the same name in
96 as well the description of
102 Don't wait if the I/O will block for operations such as
103 file block allocations, dirty page flush, mutex locks,
104 or a congested block device inside the kernel.
105 If any of these conditions are met, the control block is returned
106 immediately with a return value of
113 .BR io_getevents (2)).
115 .BR RWF_APPEND " (since Linux 4.16)"
116 .\" commit e1fc742e14e01d84d9693c4aca4ab23da65811fb
117 Append data to the end of the file.
118 See the description of the flag of the same name in
120 as well as the description of
126 field is ignored. The file offset is not changed.
130 This defines the type of I/O to be performed by the iocb structure.
132 valid values are defined by the enum defined in
133 .IR linux/aio_abi.h :
144 IOCB_CMD_PWRITEV = 8,
150 This defines the requests priority.
153 The file descriptor on which the I/O operation is to be performed.
156 This is the buffer used to transfer data for a read or write operation.
159 This is the size of the buffer pointed to by
163 This is the file offset at which the I/O operation is to be performed.
166 This is the flag to be passed iocb structure.
167 The only valid value is
168 .BR IOCB_FLAG_RESFD ,
169 which indicates that the asynchronous I/O control must signal the file
170 descriptor mentioned in
175 The file descriptor to signal in the event of asynchronous I/O completion.
179 returns the number of \fIiocb\fPs submitted (which may be
180 less than \fInr\fP, or 0 if \fInr\fP is zero).
181 For the failure return, see NOTES.
185 Insufficient resources are available to queue any \fIiocb\fPs.
188 The file descriptor specified in the first \fIiocb\fP is invalid.
191 One of the data structures points to invalid data.
194 The AIO context specified by \fIctx_id\fP is invalid.
195 \fInr\fP is less than 0.
198 is not properly initialized,
199 or the operation specified is invalid for the file descriptor
204 is not implemented on this architecture.
207 The asynchronous I/O system calls first appeared in Linux 2.5.
211 is Linux-specific and should not be used in
212 programs that are intended to be portable.
214 Glibc does not provide a wrapper function for this system call.
215 You could invoke it using
217 But instead, you probably want to use the
219 wrapper function provided by
220 .\" http://git.fedorahosted.org/git/?p=libaio.git
225 wrapper function uses a different type
227 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
234 wrapper does not follow the usual C library conventions for indicating errors:
235 on error it returns a negated error number
236 (the negative of one of the values listed in ERRORS).
237 If the system call is invoked via
239 then the return value follows the usual conventions for
240 indicating an error: \-1, with
242 set to a (positive) value that indicates the error.
246 .BR io_getevents (2),