OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man2 / io_getevents.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_GETEVENTS 2 2008-07-04 "Linux" "Linux Programmer's Manual"
24 .SH NAME
25 io_getevents \- read asynchronous I/O events from the completion queue
26 .SH "SYNOPSIS"
27 .nf
28 .\" .ad l
29 .\" .hy 0
30 .B #include <linux/time.h>
31 .B #include <libaio.h>
32 .\" #include <linux/aio.h>
33 .sp
34 .\" .HP 19
35 .BI "int io_getevents(aio_context_t " ctx_id ", long " min_nr ", long " nr ,
36 .BI "                 struct io_event *" events \
37 ", struct timespec *" timeout );
38 .\" .ad
39 .\" .hy
40 .sp
41 Link with \fI\-laio\fP.
42 .fi
43 .SH "DESCRIPTION"
44 .PP
45 .BR io_getevents ()
46 attempts to read at least \fImin_nr\fP events and
47 up to \fInr\fP events from the completion queue of the AIO context
48 specified by \fIctx_id\fP.
49 \fItimeout\fP specifies the amount of time to wait for events,
50 where a NULL timeout waits until at least \fImin_nr\fP events
51 have been seen.
52 Note that \fItimeout\fP is relative and will be updated if not NULL
53 and the operation blocks.
54 .SH "RETURN VALUE"
55 On success,
56 .BR io_getevents ()
57 returns the number of events read: 0 if no events are
58 available, or less than \fImin_nr\fP if the \fItimeout\fP has elapsed.
59 For the failure return, see NOTES.
60 .SH "ERRORS"
61 .TP
62 .B EFAULT
63 Either \fIevents\fP or \fItimeout\fP is an invalid pointer.
64 .TP
65 .B EINVAL
66 \fIctx_id\fP is invalid.
67 \fImin_nr\fP is out of range or \fInr\fP is
68 out of range.
69 .TP
70 .B EINTR
71 Interrupted by a signal handler; see
72 .BR signal (7).
73 .TP
74 .B ENOSYS
75 .BR io_getevents ()
76 is not implemented on this architecture.
77 .SH "VERSIONS"
78 .PP
79 The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
80 .SH "CONFORMING TO"
81 .PP
82 .BR io_getevents ()
83 is Linux-specific and should not be used in
84 programs that are intended to be portable.
85 .SH NOTES
86 Glibc does not provide a wrapper function for this system call.
87
88 The wrapper provided in
89 .I libaio
90 for
91 .BR io_getevents ()
92 does not follow the usual C library conventions for indicating error:
93 on error it returns a negated error number
94 (the negative of one of the values listed in ERRORS).
95 If the system call is invoked via
96 .BR syscall (2),
97 then the return value follows the usual conventions for
98 indicating an error: \-1, with
99 .I errno
100 set to a (positive) value that indicates the error.
101 .SH "SEE ALSO"
102 .PP
103 .BR io_cancel (2),
104 .BR io_destroy (2),
105 .BR io_setup (2),
106 .BR io_submit (2),
107 .BR time (7)
108 .\" .SH "NOTES"
109 .\"
110 .\" .PP
111 .\" The asynchronous I/O system calls were written by Benjamin LaHaise.
112 .\"
113 .\" .SH AUTHOR
114 .\" Kent Yoder.