teach manpages about largefile's demise
[unleashed.git] / share / man / man3c / aio_waitn.3c
blobf7b24e43954dc533dea0154b51880b45270c5955
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 AIO_WAITN 3C "Dec 18, 2008"
7 .SH NAME
8 aio_waitn \- wait for completion of asynchronous I/O operations
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <aio.h>
14 \fBint\fR \fBaio_waitn\fR(\fBstruct aiocb *\fR\fIlist\fR[], \fBuint_t\fR \fInent\fR,
15      \fBuint_t *\fR\fInwait\fR, \fBconst struct timespec *\fR\fItimeout\fR);
16 .fi
18 .SH DESCRIPTION
19 .sp
20 .LP
21 The \fBaio_waitn()\fR function suspends the calling thread until at least the
22 number of requests specified by \fInwait\fR have completed, until a signal
23 interrupts the function, or if \fItimeout\fR is not \fINULL\fR, until the time
24 interval specified by \fItimeout\fR has passed.
25 .sp
26 .LP
27 To effect a poll, the \fItimeout\fR argument should be non-zero, pointing to a
28 zero-valued \fBtimespec\fR structure.
29 .sp
30 .LP
31 The \fIlist\fR argument is an array of uninitialized I/O completion block
32 pointers to be filled in by the system before \fBaio_waitn()\fR returns. The
33 \fInent\fR argument indicates the maximum number of elements that can be placed
34 in \fIlist\fR[] and is limited to \fB_AIO_LISTIO_MAX\fR = 4096.
35 .sp
36 .LP
37 The \fInwait\fR argument points to the minimum number of requests
38 \fBaio_waitn()\fR should wait for. Upon returning, the content of \fInwait\fR
39 is set to the actual number of requests in the \fBaiocb\fR list, which can be
40 greater than the initial value specified in \fInwait\fR. The \fBaio_waitn()\fR
41 function attempts to return as many requests as possible, up to the number of
42 outstanding asynchronous I/Os but less than or equal to the maximum specified
43 by the \fInent\fR argument. As soon as the number of outstanding asynchronous
44 I/O requests becomes 0, \fBaio_waitn()\fR returns with the current list of
45 completed requests.
46 .sp
47 .LP
48 The \fBaiocb\fR structures returned will have been used in initiating an
49 asynchronous I/O request from any thread in the process with
50 \fBaio_read\fR(3C), \fBaio_write\fR(3C), or \fBlio_listio\fR(3C).
51 .sp
52 .LP
53 If the time interval expires before the expected number of I/O operations
54 specified by \fInwait\fR are completed, \fBaio_waitn()\fR returns the number of
55 completed requests and the content of the \fInwait\fR pointer is updated with
56 that number.
57 .sp
58 .LP
59 If \fBaio_waitn()\fR is interrupted by a signal, \fInwait\fR is set to the
60 number of completed requests.
61 .sp
62 .LP
63 The application can determine the status of the completed asynchronous I/O by
64 checking the associated error and return status using \fBaio_error\fR(3C) and
65 \fBaio_return\fR(3C), respectively.
66 .SH RETURN VALUES
67 .sp
68 .LP
69 Upon successful completion, \fBaio_waitn()\fR returns 0. Otherwise, it returns
70 -1 and sets \fBerrno\fR to indicate the error.
71 .SH ERRORS
72 .sp
73 .LP
74 The \fBaio_waitn()\fR function will fail if:
75 .sp
76 .ne 2
77 .na
78 \fB\fBEAGAIN\fR\fR
79 .ad
80 .RS 10n
81 There are no outstanding asynchronous I/O requests.
82 .RE
84 .sp
85 .ne 2
86 .na
87 \fB\fBEFAULT\fR\fR
88 .ad
89 .RS 10n
90 The \fIlist\fR[], \fInwait\fR, or \fItimeout\fR argument points to an address
91 outside the address space of the process. The \fBerrno\fR variable is set to
92 \fBEFAULT\fR only if this condition is detected by the application process.
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fB\fBEINTR\fR\fR
99 .ad
100 .RS 10n
101 The execution of \fBaio_waitn()\fR was interrupted by a signal.
105 .ne 2
107 \fB\fBEINVAL\fR\fR
109 .RS 10n
110 The \fItimeout\fR element \fItv_sec\fR or \fItv_nsec\fR is < 0, \fInent\fR is
111 set to 0 or > \fB_AIO_LISTIO_MAX\fR, or \fInwait\fR is either set to 0 or is >
112 \fInent\fR.
116 .ne 2
118 \fB\fBENOMEM\fR\fR
120 .RS 10n
121 There is currently not enough available memory. The application can try again
122 later.
126 .ne 2
128 \fB\fBETIME\fR\fR
130 .RS 10n
131 The time interval expired before \fInwait\fR outstanding requests have
132 completed.
135 .SH ATTRIBUTES
138 See \fBattributes\fR(5) for descriptions of the following attributes:
143 box;
144 c | c
145 l | l .
146 ATTRIBUTE TYPE  ATTRIBUTE VALUE
148 Interface Stability     Committed
150 MT-Level        Safe
153 .SH SEE ALSO
156 \fBaio.h\fR(3HEAD), \fBaio_error\fR(3C), \fBaio_read\fR(3C),
157 \fBaio_write\fR(3C), \fBlio_listio\fR(3C), \fBaio_return\fR(3C),
158 \fBattributes\fR(5)