1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" 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.
.\" 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.
.\" 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]
.TH aiowait 3C "5 Feb 2008" "SunOS 5.11" "Standard C Library Functions"
.SH NAME
aiowait \- wait for completion of asynchronous I/O operation
.SH SYNOPSIS
.LP
.nf
#include <sys/asynch.h>
#include <sys/time.h>
\fBaio_result_t *\fR\fBaiowait\fR(\fBconst struct timeval *\fR\fItimeout\fR);
.fi
.SH DESCRIPTION
.sp
.LP
The \fBaiowait()\fR function suspends the calling process until one of its
outstanding asynchronous I/O operations completes, providing a synchronous
method of notification.
.sp
.LP
If \fItimeout\fR is a non-zero pointer, it specifies a maximum interval to wait
for the completion of an asynchronous I/O operation. If \fItimeout\fR is a zero
pointer, \fBaiowait()\fR blocks indefinitely. To effect a poll, the
\fItimeout\fR parameter should be non-zero, pointing to a zero-valued
\fItimeval\fR structure.
.sp
.LP
The \fBtimeval\fR structure is defined in <\fBsys/time.h\fR> and contains the
following members:
.sp
.in +2
.nf
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
.fi
.in -2
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBaiowait()\fR returns a pointer to the result
structure used when the completed asynchronous I/O operation was requested.
Upon failure, \fBaiowait()\fR returns \fB\(mi1\fR and sets \fBerrno\fR to
indicate the error. \fBaiowait()\fR returns \fB0\fR if the time limit expires.
.SH ERRORS
.sp
.LP
The \fBaiowait()\fR function will fail if:
.sp
.ne 2
.mk
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
.rt
The \fItimeout\fR argument points to an address outside the address space of
the requesting process. See \fBNOTES\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fBEINTR\fR\fR
.ad
.RS 10n
.rt
The execution of \fBaiowait()\fR was interrupted by a signal.
.RE
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
.rt
There are no outstanding asynchronous I/O requests.
.RE
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
.rt
The \fBtv_secs\fR member of the \fBtimeval\fR structure pointed to by
\fItimeout\fR is less than 0 or the \fBtv_usecs\fR member is greater than the
number of seconds in a microsecond.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
MT-LevelSafe
.TE
.SH SEE ALSO
.sp
.LP
\fBaiocancel\fR(3C), \fBaioread\fR(3C), \fBattributes\fR(5)
.SH NOTES
.sp
.LP
The \fBaiowait()\fR function is the only way to dequeue an asynchronous
notification. It can be used either inside a \fBSIGIO\fR signal handler or in
the main program. One \fBSIGIO\fR signal can represent several queued events.
.sp
.LP
Passing an illegal address as \fItimeout\fR will result in setting \fBerrno\fR
to \fBEFAULT\fR only if detected by the application process.
|