1 .\" Copyright (C) 2003 Free Software Foundation, Inc.
2 .\" This file is distributed according to the GNU General Public License.
3 .\" See the file COPYING in the top level source directory for details.
5 .TH IO_SETUP 2 2012-05-08 "Linux" "Linux Programmer's Manual"
7 io_setup \- create an asynchronous I/O context
10 .BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
12 .BI "int io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
19 creates an asynchronous I/O context capable of receiving
20 at least \fInr_events\fP.
23 argument must not point to an AIO context that already exists, and must
24 be initialized to 0 prior to the call.
25 On successful creation of the AIO context, \fI*ctx_idp\fP is filled in
26 with the resulting handle.
31 For the failure return, see NOTES.
35 The specified \fInr_events\fP exceeds the user's limit of available events.
38 An invalid pointer is passed for \fIctx_idp\fP.
41 \fIctx_idp\fP is not initialized, or the specified \fInr_events\fP
42 exceeds internal limits.
43 \fInr_events\fP should be greater than 0.
46 Insufficient kernel resources are available.
50 is not implemented on this architecture.
53 The asynchronous I/O system calls first appeared in Linux 2.5.
57 is Linux-specific and should not be used in programs
58 that are intended to be portable.
60 Glibc does not provide a wrapper function for this system call.
61 You could invoke it using
63 But instead, you probably want to use the
65 wrapper function provided by
66 .\" http://git.fedorahosted.org/git/?p=libaio.git
71 wrapper function uses a different type
72 .RI ( "io_context_t\ *" )
73 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
80 wrapper does not follow the usual C library conventions for indicating errors:
81 on error it returns a negated error number
82 (the negative of one of the values listed in ERRORS).
83 If the system call is invoked via
85 then the return value follows the usual conventions for
86 indicating an error: \-1, with
88 set to a (positive) value that indicates the error.