.\" Copyright 2003, Free Software Foundation, Inc. .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: GPL-1.0-or-later .\" .TH io_submit 2 2026-04-11 "Linux man-pages 6.18" .SH NAME io_submit \- submit asynchronous I/O blocks for processing .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .B #include .BR "#include " " /* Definition of SYS_* constants */" .B #include .P .BI "int\~syscall(SYS_io_submit, aio_context_t\~" ctx_id , .BI " long\~" n ", struct\~iocb\~*" iocbpp [ n ]); .fi .SH DESCRIPTION .IR Note : you probably want to use the .BR io_setup (3) wrapper function provided by .IR libaio ; see VERSIONS. .P The .BR io_submit () system call queues .I n I/O request blocks for processing in the AIO context .IR ctx_id . The .I iocbpp argument should be an array of .I n AIO control blocks, which will be submitted to context .IR ctx_id . .P The .I iocb (I/O control block) structure defined in .I linux/aio_abi.h defines the parameters that control the I/O operation. .P .in +4n .EX #include \& struct iocb { __u64 aio_data; __u32 PADDED(aio_key, aio_rw_flags); __u16 aio_lio_opcode; __s16 aio_reqprio; __u32 aio_fildes; __u64 aio_buf; __u64 aio_nbytes; __s64 aio_offset; __u64 aio_reserved2; __u32 aio_flags; __u32 aio_resfd; }; .EE .in .P The fields of this structure are as follows: .TP .I aio_data This data is copied into the .I data field of the .I io_event structure upon I/O completion (see .BR io_getevents (2)). .TP .I aio_key This is an internal field used by the kernel. Do not modify this field after an .BR io_submit () call. .TP .I aio_rw_flags This defines the R/W flags passed with structure. The valid values are: .RS .TP .BR RWF_APPEND " (since Linux 4.16)" .\" commit e1fc742e14e01d84d9693c4aca4ab23da65811fb Append data to the end of the file. See the description of the flag of the same name in .BR pwritev2 (2) as well as the description of .B O_APPEND in .BR open (2). The .I aio_offset field is ignored. The file offset is not changed. .TP .BR RWF_DSYNC " (since Linux 4.13)" Write operation complete according to requirement of synchronized I/O data integrity. See the description of the flag of the same name in .BR pwritev2 (2) as well the description of .B O_DSYNC in .BR open (2). .TP .BR RWF_HIPRI " (since Linux 4.13)" High priority request, poll if possible .TP .BR RWF_NOWAIT " (since Linux 4.14)" Don't wait if the I/O will block for operations such as file block allocations, dirty page flush, mutex locks, or a congested block device inside the kernel. If any of these conditions are met, the control block is returned immediately with a return value of .B \-EAGAIN in the .I res field of the .I io_event structure (see .BR io_getevents (2)). .TP .BR RWF_SYNC " (since Linux 4.13)" Write operation complete according to requirement of synchronized I/O file integrity. See the description of the flag of the same name in .BR pwritev2 (2) as well the description of .B O_SYNC in .BR open (2). .TP .BR RWF_NOAPPEND " (since Linux 6.9)" Do not honor .B O_APPEND .BR open (2) flag. See the description of .B RWF_NOAPPEND in .BR pwritev2 (2). .TP .BR RWF_ATOMIC " (since Linux 6.11)" Write a block of data such that a write will never be torn from power fail or similar. See the description of .B RWF_ATOMIC in .BR pwritev2 (2). For usage with .BR IOCB_CMD_PWRITEV , the upper vector limit is .I stx_atomic_write_segments_max. See .B STATX_WRITE_ATOMIC and .I stx_atomic_write_segments_max description in .BR statx (2). .RE .TP .I aio_lio_opcode This defines the type of I/O to be performed by the .I iocb structure. The valid values are defined by the enum defined in .IR linux/aio_abi.h : .IP .in +4n .EX enum { IOCB_CMD_PREAD = 0, IOCB_CMD_PWRITE = 1, IOCB_CMD_FSYNC = 2, IOCB_CMD_FDSYNC = 3, IOCB_CMD_POLL = 5, IOCB_CMD_NOOP = 6, IOCB_CMD_PREADV = 7, IOCB_CMD_PWRITEV = 8, }; .EE .in .TP .I aio_reqprio This defines the requests priority. .TP .I aio_fildes The file descriptor on which the I/O operation is to be performed. .TP .I aio_buf This is the buffer used to transfer data for a read or write operation. .TP .I aio_nbytes This is the size of the buffer pointed to by .IR aio_buf . .TP .I aio_offset This is the file offset at which the I/O operation is to be performed. .TP .I aio_flags This is the set of flags associated with the .I iocb structure. The valid values are: .RS .TP .B IOCB_FLAG_RESFD Asynchronous I/O control must signal the file descriptor mentioned in .I aio_resfd upon completion. .TP .BR IOCB_FLAG_IOPRIO " (since Linux 4.18)" .\" commit d9a08a9e616beeccdbd0e7262b7225ffdfa49e92 Interpret the .I aio_reqprio field as an .B IOPRIO_VALUE as defined by .IR linux/ioprio.h . .RE .TP .I aio_resfd The file descriptor to signal in the event of asynchronous I/O completion. .SH RETURN VALUE On success, .BR io_submit () returns the number of .IR iocb s submitted (which may be less than .IR n , or 0 if .I n is zero). .P On error, \-1 is returned, and .I errno is set to indicate the error. .SH ERRORS .TP .B EAGAIN Insufficient resources are available to queue any .IR iocb s. .TP .B EBADF The file descriptor specified in the first .I iocb is invalid. .TP .B EFAULT One of the data structures points to invalid data. .TP .B EINVAL The AIO context specified by .I ctx_id is invalid. .TP .B EINVAL .I n is less than 0. .TP .B EINVAL The .I iocb at .I *iocbpp[0] is not properly initialized. .TP .B EINVAL The operation specified is invalid for the file descriptor in the .IR iocb . .TP .B EINVAL The value in the .I aio_reqprio field is invalid. .TP .B ENOSYS .BR io_submit () is not implemented on this architecture. .TP .B EPERM The .I aio_reqprio field is set with the class .BR IOPRIO_CLASS_RT , but the submitting context does not have the .B CAP_SYS_ADMIN capability. .SH VERSIONS .UR https://pagure.io/libaio .I libaio .UE provides a wrapper function with the same name, but different prototype and return value. You probably want to use that wrapper. .SH STANDARDS Linux. .SH HISTORY Linux 2.5. .SH SEE ALSO .BR io_cancel (2), .BR io_destroy (2), .BR io_getevents (2), .BR io_setup (2), .BR io_submit (3), .BR aio (7) .\" .SH AUTHOR .\" Kent Yoder.