1aio_waitn(3C) Standard C Library Functions aio_waitn(3C)
2
3
4
6 aio_waitn - wait for completion of asynchronous I/O operations
7
9 #include <aio.h>
10
11 int aio_waitn(struct aiocb *list[], uint_t nent,
12 uint_t *nwait, const struct timespec *timeout);
13
14
16 The aio_waitn() function suspends the calling thread until at least the
17 number of requests specified by nwait have completed, until a signal
18 interrupts the function, or if timeout is not NULL, until the time
19 interval specified by timeout has passed.
20
21
22 To effect a poll, the timeout argument should be non-zero, pointing to
23 a zero-valued timespec structure.
24
25
26 The list argument is an array of uninitialized I/O completion block
27 pointers to be filled in by the system before aio_waitn() returns. The
28 nent argument indicates the maximum number of elements that can be
29 placed in list[] and is limited to _AIO_LISTIO_MAX = 4096.
30
31
32 The nwait argument points to the minimum number of requests aio_waitn()
33 should wait for. Upon returning, the content of nwait is set to the
34 actual number of requests in the aiocb list, which can be greater than
35 the initial value specified in nwait. The aio_waitn() function attempts
36 to return as many requests as possible, up to the number of outstanding
37 asynchronous I/Os but less than or equal to the maximum specified by
38 the nent argument. As soon as the number of outstanding asynchronous
39 I/O requests becomes 0, aio_waitn() returns with the current list of
40 completed requests.
41
42
43 The aiocb structures returned will have been used in initiating an
44 asynchronous I/O request from any thread in the process with
45 aio_read(3C), aio_write(3C), or lio_listio(3C).
46
47
48 If the time interval expires before the expected number of I/O opera‐
49 tions specified by nwait are completed, aio_waitn() returns the number
50 of completed requests and the content of the nwait pointer is updated
51 with that number.
52
53
54 If aio_waitn() is interrupted by a signal, nwait is set to the number
55 of completed requests.
56
57
58 The application can determine the status of the completed asynchronous
59 I/O by checking the associated error and return status using
60 aio_error(3C) and aio_return(3C), respectively.
61
63 Upon successful completion, aio_waitn() returns 0. Otherwise, it
64 returns -1 and sets errno to indicate the error.
65
67 The aio_waitn() function will fail if:
68
69 EAGAIN There are no outstanding asynchronous I/O requests.
70
71
72 EFAULT The list[], nwait, or timeout argument points to an address
73 outside the address space of the process. The errno variable
74 is set to EFAULT only if this condition is detected by the
75 application process.
76
77
78 EINTR The execution of aio_waitn() was interrupted by a signal.
79
80
81 EINVAL The timeout element tv_sec or tv_nsec is < 0, nent is set to
82 0 or > _AIO_LISTIO_MAX, or nwait is either set to 0 or is >
83 nent.
84
85
86 ENOMEM There is currently not enough available memory. The applica‐
87 tion can try again later.
88
89
90 ETIME The time interval expired before nwait outstanding requests
91 have completed.
92
93
95 The aio_waitn() function has a transitional interface for 64-bit file
96 offsets. See lf64(5).
97
99 See attributes(5) for descriptions of the following attributes:
100
101
102
103
104 ┌─────────────────────────────┬─────────────────────────────┐
105 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
106 ├─────────────────────────────┼─────────────────────────────┤
107 │Interface Stability │Committed │
108 ├─────────────────────────────┼─────────────────────────────┤
109 │MT-Level │Safe │
110 └─────────────────────────────┴─────────────────────────────┘
111
113 aio.h(3HEAD), aio_error(3C), aio_read(3C), aio_write(3C), lio_lis‐
114 tio(3C), aio_return(3C), attributes(5), lf64(5)
115
116
117
118SunOS 5.11 18 Dec 2008 aio_waitn(3C)