|
Packit |
7cfc04 |
.\" Copyright (C) 2003 Free Software Foundation, Inc.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
|
|
Packit |
7cfc04 |
.\" This file is distributed according to the GNU General Public License.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.TH IO_SETUP 2 2017-09-15 "Linux" "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
io_setup \- create an asynchronous I/O context
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
.BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BI "int io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
|
|
Packit |
7cfc04 |
.fi
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.IR Note :
|
|
Packit |
7cfc04 |
There is no glibc wrapper for this system call; see NOTES.
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR io_setup ()
|
|
Packit |
7cfc04 |
system call
|
|
Packit |
7cfc04 |
creates an asynchronous I/O context suitable for concurrently processing
|
|
Packit |
7cfc04 |
\fInr_events\fP operations.
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.I ctx_idp
|
|
Packit |
7cfc04 |
argument must not point to an AIO context that already exists, and must
|
|
Packit |
7cfc04 |
be initialized to 0 prior to the call.
|
|
Packit |
7cfc04 |
On successful creation of the AIO context, \fI*ctx_idp\fP is filled in
|
|
Packit |
7cfc04 |
with the resulting handle.
|
|
Packit |
7cfc04 |
.SH RETURN VALUE
|
|
Packit |
7cfc04 |
On success,
|
|
Packit |
7cfc04 |
.BR io_setup ()
|
|
Packit |
7cfc04 |
returns 0.
|
|
Packit |
7cfc04 |
For the failure return, see NOTES.
|
|
Packit |
7cfc04 |
.SH ERRORS
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B EAGAIN
|
|
Packit |
7cfc04 |
The specified \fInr_events\fP exceeds the user's limit of available events,
|
|
Packit |
7cfc04 |
as defined in
|
|
Packit |
7cfc04 |
.IR /proc/sys/fs/aio-max-nr .
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B EFAULT
|
|
Packit |
7cfc04 |
An invalid pointer is passed for \fIctx_idp\fP.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B EINVAL
|
|
Packit |
7cfc04 |
\fIctx_idp\fP is not initialized, or the specified \fInr_events\fP
|
|
Packit |
7cfc04 |
exceeds internal limits.
|
|
Packit |
7cfc04 |
\fInr_events\fP should be greater than 0.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ENOMEM
|
|
Packit |
7cfc04 |
Insufficient kernel resources are available.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ENOSYS
|
|
Packit |
7cfc04 |
.BR io_setup ()
|
|
Packit |
7cfc04 |
is not implemented on this architecture.
|
|
Packit |
7cfc04 |
.SH VERSIONS
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The asynchronous I/O system calls first appeared in Linux 2.5.
|
|
Packit |
7cfc04 |
.SH CONFORMING TO
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BR io_setup ()
|
|
Packit |
7cfc04 |
is Linux-specific and should not be used in programs
|
|
Packit |
7cfc04 |
that are intended to be portable.
|
|
Packit |
7cfc04 |
.SH NOTES
|
|
Packit |
7cfc04 |
Glibc does not provide a wrapper function for this system call.
|
|
Packit |
7cfc04 |
You could invoke it using
|
|
Packit |
7cfc04 |
.BR syscall (2).
|
|
Packit |
7cfc04 |
But instead, you probably want to use the
|
|
Packit |
7cfc04 |
.BR io_setup ()
|
|
Packit |
7cfc04 |
wrapper function provided by
|
|
Packit |
7cfc04 |
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
|
Packit |
7cfc04 |
.IR libaio .
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Note that the
|
|
Packit |
7cfc04 |
.I libaio
|
|
Packit |
7cfc04 |
wrapper function uses a different type
|
|
Packit |
7cfc04 |
.RI ( "io_context_t\ *" )
|
|
Packit |
7cfc04 |
.\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
|
|
Packit |
7cfc04 |
.\" the system call.
|
|
Packit |
7cfc04 |
for the
|
|
Packit |
7cfc04 |
.I ctx_idp
|
|
Packit |
7cfc04 |
argument.
|
|
Packit |
7cfc04 |
Note also that the
|
|
Packit |
7cfc04 |
.I libaio
|
|
Packit |
7cfc04 |
wrapper does not follow the usual C library conventions for indicating errors:
|
|
Packit |
7cfc04 |
on error it returns a negated error number
|
|
Packit |
7cfc04 |
(the negative of one of the values listed in ERRORS).
|
|
Packit |
7cfc04 |
If the system call is invoked via
|
|
Packit |
7cfc04 |
.BR syscall (2),
|
|
Packit |
7cfc04 |
then the return value follows the usual conventions for
|
|
Packit |
7cfc04 |
indicating an error: \-1, with
|
|
Packit |
7cfc04 |
.I errno
|
|
Packit |
7cfc04 |
set to a (positive) value that indicates the error.
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
.BR io_cancel (2),
|
|
Packit |
7cfc04 |
.BR io_destroy (2),
|
|
Packit |
7cfc04 |
.BR io_getevents (2),
|
|
Packit |
7cfc04 |
.BR io_submit (2),
|
|
Packit |
7cfc04 |
.BR aio (7)
|
|
Packit |
7cfc04 |
.\" .SH AUTHOR
|
|
Packit |
7cfc04 |
.\" Kent Yoder.
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|