1io_setup(2) System Calls Manual io_setup(2)
2
3
4
6 io_setup - create an asynchronous I/O context
7
9 Standard C library (libc, -lc)
10
11 Alternatively, Asynchronous I/O library (libaio, -laio); see VERSIONS.
12
14 #include <linux/aio_abi.h> /* Defines needed types */
15
16 long io_setup(unsigned int nr_events, aio_context_t *ctx_idp);
17
18 Note: There is no glibc wrapper for this system call; see VERSIONS.
19
21 Note: this page describes the raw Linux system call interface. The
22 wrapper function provided by libaio uses a different type for the
23 ctx_idp argument. See VERSIONS.
24
25 The io_setup() system call creates an asynchronous I/O context suitable
26 for concurrently processing nr_events operations. The ctx_idp argument
27 must not point to an AIO context that already exists, and must be ini‐
28 tialized to 0 prior to the call. On successful creation of the AIO
29 context, *ctx_idp is filled in with the resulting handle.
30
32 On success, io_setup() returns 0. For the failure return, see VER‐
33 SIONS.
34
36 EAGAIN The specified nr_events exceeds the limit of available events,
37 as defined in /proc/sys/fs/aio-max-nr (see proc(5)).
38
39 EFAULT An invalid pointer is passed for ctx_idp.
40
41 EINVAL ctx_idp is not initialized, or the specified nr_events exceeds
42 internal limits. nr_events should be greater than 0.
43
44 ENOMEM Insufficient kernel resources are available.
45
46 ENOSYS io_setup() is not implemented on this architecture.
47
49 glibc does not provide a wrapper for this system call. You could in‐
50 voke it using syscall(2). But instead, you probably want to use the
51 io_setup() wrapper function provided by libaio.
52
53 Note that the libaio wrapper function uses a different type (io_con‐
54 text_t *) for the ctx_idp argument. Note also that the libaio wrapper
55 does not follow the usual C library conventions for indicating errors:
56 on error it returns a negated error number (the negative of one of the
57 values listed in ERRORS). If the system call is invoked via
58 syscall(2), then the return value follows the usual conventions for in‐
59 dicating an error: -1, with errno set to a (positive) value that indi‐
60 cates the error.
61
63 Linux.
64
66 Linux 2.5.
67
69 io_cancel(2), io_destroy(2), io_getevents(2), io_submit(2), aio(7)
70
71
72
73Linux man-pages 6.04 2023-03-30 io_setup(2)