8498 ficl: variable 'count' might be clobbered by 'longjmp' or 'vfork'
[unleashed.git] / share / man / man3c / aiowait.3c
blob14408ea7fbb38f127590f32d59a08dc49539fddf
1 '\" te
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"
7 .SH NAME
8 aiowait \- wait for completion of asynchronous I/O operation
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/asynch.h>
13 #include <sys/time.h>
15 \fBaio_result_t *\fR\fBaiowait\fR(\fBconst struct timeval *\fR\fItimeout\fR);
16 .fi
18 .SH DESCRIPTION
19 .sp
20 .LP
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.
24 .sp
25 .LP
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.
31 .sp
32 .LP
33 The \fBtimeval\fR structure is defined in <\fBsys/time.h\fR> and contains the
34 following members:
35 .sp
36 .in +2
37 .nf
38 long  tv_sec;           /* seconds */
39 long  tv_usec;          /* and microseconds */
40 .fi
41 .in -2
43 .SH RETURN VALUES
44 .sp
45 .LP
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.
50 .SH ERRORS
51 .sp
52 .LP
53 The \fBaiowait()\fR function will fail if:
54 .sp
55 .ne 2
56 .na
57 \fB\fBEFAULT\fR\fR
58 .ad
59 .RS 10n
60 The \fItimeout\fR argument points to an address outside the address space of
61 the requesting process.  See \fBNOTES\fR.
62 .RE
64 .sp
65 .ne 2
66 .na
67 \fB\fBEINTR\fR\fR
68 .ad
69 .RS 10n
70 The execution of \fBaiowait()\fR was interrupted by a signal.
71 .RE
73 .sp
74 .ne 2
75 .na
76 \fB\fBEINVAL\fR\fR
77 .ad
78 .RS 10n
79 There are no outstanding asynchronous I/O requests.
80 .RE
82 .sp
83 .ne 2
84 .na
85 \fB\fBEINVAL\fR\fR
86 .ad
87 .RS 10n
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.
91 .RE
93 .SH ATTRIBUTES
94 .sp
95 .LP
96 See \fBattributes\fR(5) for descriptions of the following attributes:
97 .sp
99 .sp
101 box;
102 c | c
103 l | l .
104 ATTRIBUTE TYPE  ATTRIBUTE VALUE
106 MT-Level        Safe
109 .SH SEE ALSO
112 \fBaiocancel\fR(3C), \fBaioread\fR(3C), \fBattributes\fR(5)
113 .SH NOTES
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.