2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright (C) 2003 Free Software Foundation, Inc.
|
|
|
|
.\" This file is distributed according to the GNU General Public License.
|
|
|
|
.\" See the file COPYING in the top level source directory for details.
|
|
|
|
.\"
|
2012-11-11 08:08:32 +00:00
|
|
|
.TH IO_GETEVENTS 2 2012-11-11 "Linux" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
2007-04-03 12:47:21 +00:00
|
|
|
io_getevents \- read asynchronous I/O events from the completion queue
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SYNOPSIS"
|
2007-04-03 12:47:21 +00:00
|
|
|
.nf
|
2012-05-08 02:41:17 +00:00
|
|
|
.BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
|
|
|
|
.BR "#include <linux/time.h>" " /* Defines 'struct timespec' */"
|
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2007-04-12 22:42:49 +00:00
|
|
|
.BI "int io_getevents(aio_context_t " ctx_id ", long " min_nr ", long " nr ,
|
2007-04-03 12:47:21 +00:00
|
|
|
.BI " struct io_event *" events \
|
|
|
|
", struct timespec *" timeout );
|
|
|
|
.fi
|
get_robust_list.2, get_thread_area.2, getcpu.2, getdents.2, gettid.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioprio_set.2, kexec_load.2, llseek.2, modify_ldt.2, mq_getsetattr.2, pivot_root.2, readdir.2, rt_sigqueueinfo.2, set_thread_area.2, sgetmask.2, spu_create.2, spu_run.2, subpage_prot.2, sysctl.2, tkill.2: Add note to SYNOPSIS that there is no glibc wrapper for system call
Reduce the chance that the reader may be misled into thinking
that there is a wrapper function for this system call by noting
explicitly in the SYNOPSIS that there is no glibc wrapper and
pointing the reader to NOTES for further details.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-07-13 06:48:20 +00:00
|
|
|
|
|
|
|
.IR Note :
|
|
|
|
There is no glibc wrapper for this system call; see NOTES.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "DESCRIPTION"
|
|
|
|
.PP
|
2012-05-08 02:41:17 +00:00
|
|
|
The
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR io_getevents ()
|
2012-05-08 02:41:17 +00:00
|
|
|
system call
|
2007-07-18 20:24:30 +00:00
|
|
|
attempts to read at least \fImin_nr\fP events and
|
|
|
|
up to \fInr\fP events from the completion queue of the AIO context
|
|
|
|
specified by \fIctx_id\fP.
|
2012-05-08 02:41:17 +00:00
|
|
|
The \fItimeout\fP argument specifies the amount of time to wait for events,
|
2007-07-18 20:24:30 +00:00
|
|
|
where a NULL timeout waits until at least \fImin_nr\fP events
|
2007-04-12 22:42:49 +00:00
|
|
|
have been seen.
|
2007-07-18 20:24:30 +00:00
|
|
|
Note that \fItimeout\fP is relative and will be updated if not NULL
|
2004-11-03 13:51:07 +00:00
|
|
|
and the operation blocks.
|
|
|
|
.SH "RETURN VALUE"
|
2007-04-12 22:42:49 +00:00
|
|
|
On success,
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR io_getevents ()
|
|
|
|
returns the number of events read: 0 if no events are
|
2008-06-18 20:24:08 +00:00
|
|
|
available, or less than \fImin_nr\fP if the \fItimeout\fP has elapsed.
|
|
|
|
For the failure return, see NOTES.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "ERRORS"
|
|
|
|
.TP
|
2008-06-11 13:57:31 +00:00
|
|
|
.B EFAULT
|
|
|
|
Either \fIevents\fP or \fItimeout\fP is an invalid pointer.
|
|
|
|
.TP
|
2007-04-03 12:47:21 +00:00
|
|
|
.B EINVAL
|
2007-07-18 20:24:30 +00:00
|
|
|
\fIctx_id\fP is invalid.
|
|
|
|
\fImin_nr\fP is out of range or \fInr\fP is
|
2004-11-03 13:51:07 +00:00
|
|
|
out of range.
|
|
|
|
.TP
|
2008-07-04 15:40:42 +00:00
|
|
|
.B EINTR
|
|
|
|
Interrupted by a signal handler; see
|
|
|
|
.BR signal (7).
|
|
|
|
.TP
|
2007-04-03 12:47:21 +00:00
|
|
|
.B ENOSYS
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR io_getevents ()
|
|
|
|
is not implemented on this architecture.
|
2007-05-18 16:06:42 +00:00
|
|
|
.SH "VERSIONS"
|
|
|
|
.PP
|
2012-05-08 02:41:17 +00:00
|
|
|
The asynchronous I/O system calls first appeared in Linux 2.5.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "CONFORMING TO"
|
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR io_getevents ()
|
2007-12-25 21:28:09 +00:00
|
|
|
is Linux-specific and should not be used in
|
2006-12-17 01:34:44 +00:00
|
|
|
programs that are intended to be portable.
|
2008-06-18 20:24:08 +00:00
|
|
|
.SH NOTES
|
|
|
|
Glibc does not provide a wrapper function for this system call.
|
2012-05-08 02:41:17 +00:00
|
|
|
You could invoke it using
|
|
|
|
.BR syscall (2).
|
|
|
|
But instead, you probably want to use the
|
|
|
|
.BR io_getevents ()
|
|
|
|
wrapper function provided by
|
|
|
|
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
|
|
|
.IR libaio .
|
2008-06-18 20:24:08 +00:00
|
|
|
|
2012-05-08 02:41:17 +00:00
|
|
|
Note that the
|
2008-06-18 20:24:08 +00:00
|
|
|
.I libaio
|
2012-05-08 02:41:17 +00:00
|
|
|
wrapper function uses a different type
|
|
|
|
.RI ( io_context_t )
|
|
|
|
.\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
|
|
|
|
.\" the system call.
|
|
|
|
for the
|
|
|
|
.I ctx_id
|
|
|
|
argument.
|
|
|
|
Note also that the
|
|
|
|
.I libaio
|
|
|
|
wrapper does not follow the usual C library conventions for indicating errors:
|
2008-06-18 20:24:08 +00:00
|
|
|
on error it returns a negated error number
|
|
|
|
(the negative of one of the values listed in ERRORS).
|
|
|
|
If the system call is invoked via
|
|
|
|
.BR syscall (2),
|
|
|
|
then the return value follows the usual conventions for
|
|
|
|
indicating an error: \-1, with
|
|
|
|
.I errno
|
|
|
|
set to a (positive) value that indicates the error.
|
2012-11-11 08:08:32 +00:00
|
|
|
.SH BUGS
|
|
|
|
An invalid
|
|
|
|
.IR ctx_id
|
|
|
|
may cause a segmentation fault instead of genenerating the error
|
|
|
|
.BR EINVAL .
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR io_cancel (2),
|
2008-06-11 13:57:31 +00:00
|
|
|
.BR io_destroy (2),
|
|
|
|
.BR io_setup (2),
|
2008-06-23 08:48:25 +00:00
|
|
|
.BR io_submit (2),
|
2010-10-03 04:36:31 +00:00
|
|
|
.BR aio (7),
|
2008-06-23 08:48:25 +00:00
|
|
|
.BR time (7)
|
2007-04-03 12:47:21 +00:00
|
|
|
.\" .SH AUTHOR
|
|
|
|
.\" Kent Yoder.
|