428 lines
9.6 KiB
HTML
428 lines
9.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of IO_SUBMIT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>IO_SUBMIT</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-10-10<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
io_submit - submit asynchronous I/O blocks for processing
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/linux/aio_abi.h">linux/aio_abi.h</A>></B> /* Defines needed types */
|
|
|
|
<B>int io_submit(aio_context_t </B><I>ctx_id</I><B>, long </B><I>nr</I><B>, struct iocb **</B><I>iocbpp</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<I>Note</I>:
|
|
|
|
There is no glibc wrapper for this system call; see NOTES.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
The
|
|
<B>io_submit</B>()
|
|
|
|
system call
|
|
queues <I>nr</I> I/O request blocks for processing in
|
|
the AIO context <I>ctx_id</I>.
|
|
The
|
|
<I>iocbpp</I>
|
|
|
|
argument should be an array of <I>nr</I> AIO control blocks,
|
|
which will be submitted to context <I>ctx_id</I>.
|
|
<P>
|
|
|
|
The
|
|
<I>iocb</I>
|
|
|
|
(I/O control block) structure defined in
|
|
<I>linux/aio_abi.h</I>
|
|
|
|
defines the parameters that control the I/O operation.
|
|
<P>
|
|
|
|
|
|
|
|
#include <<A HREF="file:///usr/include/linux/aio_abi.h">linux/aio_abi.h</A>>
|
|
<P>
|
|
struct iocb {
|
|
<BR> __u64 aio_data;
|
|
<BR> __u32 PADDED(aio_key, aio_rw_flags);
|
|
<BR> __u16 aio_lio_opcode;
|
|
<BR> __s16 aio_reqprio;
|
|
<BR> __u32 aio_fildes;
|
|
<BR> __u64 aio_buf;
|
|
<BR> __u64 aio_nbytes;
|
|
<BR> __s64 aio_offset;
|
|
<BR> __u64 aio_reserved2;
|
|
<BR> __u32 aio_flags;
|
|
<BR> __u32 aio_resfd;
|
|
};
|
|
|
|
|
|
<P>
|
|
|
|
The fields of this structure are as follows:
|
|
<DL COMPACT>
|
|
<DT id="1"><I>aio_data</I>
|
|
|
|
<DD>
|
|
This data is copied into the
|
|
<I>data</I>
|
|
|
|
field of the
|
|
<I>io_event</I>
|
|
|
|
structure upon I/O completion (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_getevents">io_getevents</A></B>(2)).
|
|
|
|
<DT id="2"><I>aio_key</I>
|
|
|
|
<DD>
|
|
This is an internal field used by the kernel.
|
|
Do not modify this field after an
|
|
<B>io_submit</B>()
|
|
|
|
call.
|
|
<DT id="3"><I>aio_rw_flags</I>
|
|
|
|
<DD>
|
|
This defines the R/W flags passed with structure.
|
|
The valid values are:
|
|
<DL COMPACT><DT id="4"><DD>
|
|
<DL COMPACT>
|
|
<DT id="5"><B>RWF_APPEND</B> (since Linux 4.16)
|
|
|
|
<DD>
|
|
|
|
Append data to the end of the file.
|
|
See the description of the flag of the same name in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pwritev2">pwritev2</A></B>(2)
|
|
|
|
as well as the description of
|
|
<B>O_APPEND</B>
|
|
|
|
in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2).
|
|
|
|
The
|
|
<I>aio_offset</I>
|
|
|
|
field is ignored.
|
|
The file offset is not changed.
|
|
<DT id="6"><B>RWF_DSYNC</B> (since Linux 4.13)
|
|
|
|
<DD>
|
|
Write operation complete according to requirement of
|
|
synchronized I/O data integrity.
|
|
See the description of the flag of the same name in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pwritev2">pwritev2</A></B>(2)
|
|
|
|
as well the description of
|
|
<B>O_DSYNC</B>
|
|
|
|
in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2).
|
|
|
|
<DT id="7"><B>RWF_HIPRI</B> (since Linux 4.13)
|
|
|
|
<DD>
|
|
High priority request, poll if possible
|
|
<DT id="8"><B>RWF_NOWAIT</B> (since Linux 4.14)
|
|
|
|
<DD>
|
|
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</B>
|
|
|
|
in the
|
|
<I>res</I>
|
|
|
|
field of the
|
|
<I>io_event</I>
|
|
|
|
structure (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_getevents">io_getevents</A></B>(2)).
|
|
|
|
<DT id="9"><B>RWF_SYNC</B> (since Linux 4.13)
|
|
|
|
<DD>
|
|
Write operation complete according to requirement of
|
|
synchronized I/O file integrity.
|
|
See the description of the flag of the same name in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pwritev2">pwritev2</A></B>(2)
|
|
|
|
as well the description of
|
|
<B>O_SYNC</B>
|
|
|
|
in
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2).
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="10"><I>aio_lio_opcode</I>
|
|
|
|
<DD>
|
|
This defines the type of I/O to be performed by the
|
|
<I>iocb</I>
|
|
|
|
structure.
|
|
The
|
|
valid values are defined by the enum defined in
|
|
<I>linux/aio_abi.h</I>:
|
|
|
|
<DT id="11"><DD>
|
|
|
|
|
|
enum {
|
|
<BR> IOCB_CMD_PREAD = 0,
|
|
<BR> IOCB_CMD_PWRITE = 1,
|
|
<BR> IOCB_CMD_FSYNC = 2,
|
|
<BR> IOCB_CMD_FDSYNC = 3,
|
|
<BR> IOCB_CMD_NOOP = 6,
|
|
<BR> IOCB_CMD_PREADV = 7,
|
|
<BR> IOCB_CMD_PWRITEV = 8,
|
|
};
|
|
|
|
|
|
<DT id="12"><I>aio_reqprio</I>
|
|
|
|
<DD>
|
|
This defines the requests priority.
|
|
<DT id="13"><I>aio_fildes</I>
|
|
|
|
<DD>
|
|
The file descriptor on which the I/O operation is to be performed.
|
|
<DT id="14"><I>aio_buf</I>
|
|
|
|
<DD>
|
|
This is the buffer used to transfer data for a read or write operation.
|
|
<DT id="15"><I>aio_nbytes</I>
|
|
|
|
<DD>
|
|
This is the size of the buffer pointed to by
|
|
<I>aio_buf</I>.
|
|
|
|
<DT id="16"><I>aio_offset</I>
|
|
|
|
<DD>
|
|
This is the file offset at which the I/O operation is to be performed.
|
|
<DT id="17"><I>aio_flags</I>
|
|
|
|
<DD>
|
|
This is the set of flags associated with the
|
|
<I>iocb</I>
|
|
|
|
structure.
|
|
The valid values are:
|
|
<DL COMPACT><DT id="18"><DD>
|
|
<DL COMPACT>
|
|
<DT id="19"><B>IOCB_FLAG_RESFD</B>
|
|
|
|
<DD>
|
|
Asynchronous I/O control must signal the file
|
|
descriptor mentioned in
|
|
<I>aio_resfd</I>
|
|
|
|
upon completion.
|
|
<DT id="20"><B>IOCB_FLAG_IOPRIO</B> (since Linux 4.18)
|
|
|
|
<DD>
|
|
|
|
Interpret the
|
|
<I>aio_reqprio</I>
|
|
|
|
field as an
|
|
<B>IOPRIO_VALUE</B>
|
|
|
|
as defined by
|
|
<I>linux/ioprio.h</I>.
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="21"><I>aio_resfd</I>
|
|
|
|
<DD>
|
|
The file descriptor to signal in the event of asynchronous I/O completion.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>io_submit</B>()
|
|
|
|
returns the number of <I>iocb</I>s submitted (which may be
|
|
less than <I>nr</I>, or 0 if <I>nr</I> is zero).
|
|
For the failure return, see NOTES.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="22"><B>EAGAIN</B>
|
|
|
|
<DD>
|
|
Insufficient resources are available to queue any <I>iocb</I>s.
|
|
<DT id="23"><B>EBADF</B>
|
|
|
|
<DD>
|
|
The file descriptor specified in the first <I>iocb</I> is invalid.
|
|
<DT id="24"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
One of the data structures points to invalid data.
|
|
<DT id="25"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
The AIO context specified by <I>ctx_id</I> is invalid.
|
|
<I>nr</I> is less than 0.
|
|
The <I>iocb</I> at
|
|
<I>*iocbpp[0]</I>
|
|
|
|
is not properly initialized, the operation specified is invalid for the file
|
|
descriptor in the <I>iocb</I>, or the value in the
|
|
<I>aio_reqprio</I>
|
|
|
|
field is invalid.
|
|
<DT id="26"><B>ENOSYS</B>
|
|
|
|
<DD>
|
|
<B>io_submit</B>()
|
|
|
|
is not implemented on this architecture.
|
|
<DT id="27"><B>EPERM</B>
|
|
|
|
<DD>
|
|
The
|
|
<I>aio_reqprio</I>
|
|
|
|
field is set with the class
|
|
<B>IOPRIO_CLASS_RT</B>,
|
|
|
|
but the submitting context does not have the
|
|
<B>CAP_SYS_ADMIN</B>
|
|
|
|
capability.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
<P>
|
|
|
|
The asynchronous I/O system calls first appeared in Linux 2.5.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
<P>
|
|
|
|
<B>io_submit</B>()
|
|
|
|
is Linux-specific and should not be used in
|
|
programs that are intended to be portable.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
Glibc does not provide a wrapper function for this system call.
|
|
You could invoke it using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2).
|
|
|
|
But instead, you probably want to use the
|
|
<B>io_submit</B>()
|
|
|
|
wrapper function provided by
|
|
|
|
<I>libaio</I>.
|
|
|
|
<P>
|
|
|
|
Note that the
|
|
<I>libaio</I>
|
|
|
|
wrapper function uses a different type
|
|
(<I>io_context_t</I>)
|
|
|
|
|
|
|
|
for the
|
|
<I>ctx_id</I>
|
|
|
|
argument.
|
|
Note also that the
|
|
<I>libaio</I>
|
|
|
|
wrapper does not follow the usual C library conventions for indicating errors:
|
|
on error it returns a negated error number
|
|
(the negative of one of the values listed in ERRORS).
|
|
If the system call is invoked via
|
|
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2),
|
|
|
|
then the return value follows the usual conventions for
|
|
indicating an error: -1, with
|
|
<I>errno</I>
|
|
|
|
set to a (positive) value that indicates the error.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_cancel">io_cancel</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_destroy">io_destroy</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_getevents">io_getevents</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_setup">io_setup</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+aio">aio</A></B>(7)
|
|
|
|
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="28"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="29"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="30"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="31"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="32"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="33"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="34"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="35"><A HREF="#lbAI">NOTES</A><DD>
|
|
<DT id="36"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="37"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:33 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|