2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH AIOWAIT 3C "Feb 5, 2008"
8 aiowait \- wait for completion of asynchronous I/O operation
12 #include <sys/asynch.h>
15 \fBaio_result_t *\fR\fBaiowait\fR(\fBconst struct timeval *\fR\fItimeout\fR);
21 The \fBaiowait()\fR function suspends the calling process until one of its
22 outstanding asynchronous I/O operations completes, providing a synchronous
23 method of notification.
26 If \fItimeout\fR is a non-zero pointer, it specifies a maximum interval to wait
27 for the completion of an asynchronous I/O operation. If \fItimeout\fR is a zero
28 pointer, \fBaiowait()\fR blocks indefinitely. To effect a poll, the
29 \fItimeout\fR parameter should be non-zero, pointing to a zero-valued
30 \fItimeval\fR structure.
33 The \fBtimeval\fR structure is defined in <\fBsys/time.h\fR> and contains the
38 long tv_sec; /* seconds */
39 long tv_usec; /* and microseconds */
46 Upon successful completion, \fBaiowait()\fR returns a pointer to the result
47 structure used when the completed asynchronous I/O operation was requested.
48 Upon failure, \fBaiowait()\fR returns \fB\(mi1\fR and sets \fBerrno\fR to
49 indicate the error. \fBaiowait()\fR returns \fB0\fR if the time limit expires.
53 The \fBaiowait()\fR function will fail if:
60 The \fItimeout\fR argument points to an address outside the address space of
61 the requesting process. See \fBNOTES\fR.
70 The execution of \fBaiowait()\fR was interrupted by a signal.
79 There are no outstanding asynchronous I/O requests.
88 The \fBtv_secs\fR member of the \fBtimeval\fR structure pointed to by
89 \fItimeout\fR is less than 0 or the \fBtv_usecs\fR member is greater than the
90 number of seconds in a microsecond.
96 See \fBattributes\fR(5) for descriptions of the following attributes:
104 ATTRIBUTE TYPE ATTRIBUTE VALUE
112 \fBaiocancel\fR(3C), \fBaioread\fR(3C), \fBattributes\fR(5)
116 The \fBaiowait()\fR function is the only way to dequeue an asynchronous
117 notification. It can be used either inside a \fBSIGIO\fR signal handler or in
118 the main program. One \fBSIGIO\fR signal can represent several queued events.
121 Passing an illegal address as \fItimeout\fR will result in setting \fBerrno\fR
122 to \fBEFAULT\fR only if detected by the application process.