OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man2 / io_setup.2
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.
4 .\"
5 .\" .de Sh \" Subsection
6 .\" .br
7 .\" .if t .Sp
8 .\" .ne 5
9 .\" .PP
10 .\" \fB\\$1\fP
11 .\" .PP
12 .\" ..
13 .\" .de Sp \" Vertical space (when we can't use .PP)
14 .\" .if t .sp .5v
15 .\" .if n .sp
16 .\" ..
17 .\" .de Ip \" List item
18 .\" .br
19 .\" .ie \\n(.$>=3 .ne \\$3
20 .\" .el .ne 3
21 .\" .IP "\\$1" \\$2
22 .\" ..
23 .TH IO_SETUP 2 2008-06-18 "Linux" "Linux Programmer's Manual"
24 .SH NAME
25 io_setup \- create an asynchronous I/O context
26 .SH "SYNOPSIS"
27 .nf
28 .\" .ad l
29 .\" .hy 0
30 .B #include <libaio.h>
31 .\" #include <linux/aio.h>
32 .sp
33 .\" .HP 15
34 .BI "int io_setup(unsigned " nr_events ", aio_context_t *" ctxp );
35 .\" .ad
36 .\" .hy
37 .sp
38 Link with \fI\-laio\fP.
39 .fi
40 .SH "DESCRIPTION"
41 .PP
42 .BR io_setup ()
43 creates an asynchronous I/O context capable of receiving
44 at least \fInr_events\fP.
45 \fIctxp\fP must not point to an AIO context that already exists, and must
46 be initialized to 0 prior to the call.
47 On successful creation of the AIO context, \fI*ctxp\fP is filled in
48 with the resulting handle.
49 .SH "RETURN VALUE"
50 On success,
51 .BR io_setup ()
52 returns 0.
53 For the failure return, see NOTES.
54 .SH "ERRORS"
55 .TP
56 .B EAGAIN
57 The specified \fInr_events\fP exceeds the user's limit of available events.
58 .TP
59 .B EFAULT
60 An invalid pointer is passed for \fIctxp\fP.
61 .TP
62 .B EINVAL
63 \fIctxp\fP is not initialized, or the specified \fInr_events\fP
64 exceeds internal limits.
65 \fInr_events\fP should be greater than 0.
66 .TP
67 .B ENOMEM
68 Insufficient kernel resources are available.
69 .TP
70 .B ENOSYS
71 .BR io_setup ()
72 is not implemented on this architecture.
73 .SH "VERSIONS"
74 .PP
75 The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
76 .SH "CONFORMING TO"
77 .PP
78 .BR io_setup ()
79 is Linux-specific and should not be used in programs
80 that are intended to be portable.
81 .SH NOTES
82 Glibc does not provide a wrapper function for this system call.
83
84 The wrapper provided in
85 .I libaio
86 for
87 .BR io_setup ()
88 does not follow the usual C library conventions for indicating error:
89 on error it returns a negated error number
90 (the negative of one of the values listed in ERRORS).
91 If the system call is invoked via
92 .BR syscall (2),
93 then the return value follows the usual conventions for
94 indicating an error: \-1, with
95 .I errno
96 set to a (positive) value that indicates the error.
97 .SH "SEE ALSO"
98 .BR io_cancel (2),
99 .BR io_destroy (2),
100 .BR io_getevents (2),
101 .BR io_submit (2)
102 .\" .SH "NOTES"
103 .\" .PP
104 .\" The asynchronous I/O system calls were written by Benjamin LaHaise.
105 .\" .SH AUTHOR
106 .\" Kent Yoder.