1IO_SETUP(2)                Linux Programmer's Manual               IO_SETUP(2)
2
3
4

NAME

6       io_setup - create an asynchronous I/O context
7

SYNOPSIS

9       #include <linux/aio_abi.h>          /* Defines needed types */
10
11       long io_setup(unsigned int nr_events, aio_context_t *ctx_idp);
12
13       Note: There is no glibc wrapper for this system call; see NOTES.
14

DESCRIPTION

16       Note:  this  page  describes  the raw Linux system call interface.  The
17       wrapper function provided by libaio  uses  a  different  type  for  the
18       ctx_idp argument.  See NOTES.
19
20       The io_setup() system call creates an asynchronous I/O context suitable
21       for concurrently processing nr_events operations.  The ctx_idp argument
22       must  not point to an AIO context that already exists, and must be ini‐
23       tialized to 0 prior to the call.  On successful  creation  of  the  AIO
24       context, *ctx_idp is filled in with the resulting handle.
25

RETURN VALUE

27       On success, io_setup() returns 0.  For the failure return, see NOTES.
28

ERRORS

30       EAGAIN The  specified  nr_events exceeds the limit of available events,
31              as defined in /proc/sys/fs/aio-max-nr (see proc(5)).
32
33       EFAULT An invalid pointer is passed for ctx_idp.
34
35       EINVAL ctx_idp is not initialized, or the specified  nr_events  exceeds
36              internal limits.  nr_events should be greater than 0.
37
38       ENOMEM Insufficient kernel resources are available.
39
40       ENOSYS io_setup() is not implemented on this architecture.
41

VERSIONS

43       The asynchronous I/O system calls first appeared in Linux 2.5.
44

CONFORMING TO

46       io_setup()  is  Linux-specific  and should not be used in programs that
47       are intended to be portable.
48

NOTES

50       Glibc does not provide a wrapper for this system call.  You  could  in‐
51       voke  it  using  syscall(2).  But instead, you probably want to use the
52       io_setup() wrapper function provided by libaio.
53
54       Note that the libaio wrapper function uses a  different  type  (io_con‐
55       text_t *)  for the ctx_idp argument.  Note also that the libaio wrapper
56       does not follow the usual C library conventions for indicating  errors:
57       on  error it returns a negated error number (the negative of one of the
58       values  listed  in  ERRORS).   If  the  system  call  is  invoked   via
59       syscall(2), then the return value follows the usual conventions for in‐
60       dicating an error: -1, with errno set to a (positive) value that  indi‐
61       cates the error.
62

SEE ALSO

64       io_cancel(2), io_destroy(2), io_getevents(2), io_submit(2), aio(7)
65

COLOPHON

67       This  page  is  part of release 5.13 of the Linux man-pages project.  A
68       description of the project, information about reporting bugs,  and  the
69       latest     version     of     this    page,    can    be    found    at
70       https://www.kernel.org/doc/man-pages/.
71
72
73
74Linux                             2021-03-22                       IO_SETUP(2)
Impressum