xref: /freebsd/lib/libsys/aio_waitcomplete.2 (revision 8269e7673cf033aba67dab8264fe719920c70f87)
1*8269e767SBrooks Davis.\" Copyright (c) 1999 Christopher M Sedore.
2*8269e767SBrooks Davis.\" All rights reserved.
3*8269e767SBrooks Davis.\"
4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions
6*8269e767SBrooks Davis.\" are met:
7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
8*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
10*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
11*8269e767SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
12*8269e767SBrooks Davis.\"
13*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND
14*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*8269e767SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*8269e767SBrooks Davis.\" SUCH DAMAGE.
24*8269e767SBrooks Davis.\"
25*8269e767SBrooks Davis.Dd March 21, 2016
26*8269e767SBrooks Davis.Dt AIO_WAITCOMPLETE 2
27*8269e767SBrooks Davis.Os
28*8269e767SBrooks Davis.Sh NAME
29*8269e767SBrooks Davis.Nm aio_waitcomplete
30*8269e767SBrooks Davis.Nd wait for the next completion of an aio request
31*8269e767SBrooks Davis.Sh LIBRARY
32*8269e767SBrooks Davis.Lb libc
33*8269e767SBrooks Davis.Sh SYNOPSIS
34*8269e767SBrooks Davis.In aio.h
35*8269e767SBrooks Davis.Ft ssize_t
36*8269e767SBrooks Davis.Fn aio_waitcomplete "struct aiocb **iocbp" "struct timespec *timeout"
37*8269e767SBrooks Davis.Sh DESCRIPTION
38*8269e767SBrooks DavisThe
39*8269e767SBrooks Davis.Fn aio_waitcomplete
40*8269e767SBrooks Davissystem call waits for completion of an asynchronous I/O request.
41*8269e767SBrooks DavisUpon completion,
42*8269e767SBrooks Davis.Fn aio_waitcomplete
43*8269e767SBrooks Davisreturns the result of the function and sets
44*8269e767SBrooks Davis.Fa iocbp
45*8269e767SBrooks Davisto point to the structure associated with the original request.
46*8269e767SBrooks DavisIf an asynchronous I/O request is completed before
47*8269e767SBrooks Davis.Fn aio_waitcomplete
48*8269e767SBrooks Davisis called, it returns immediately with the completed request.
49*8269e767SBrooks Davis.Pp
50*8269e767SBrooks DavisIf
51*8269e767SBrooks Davis.Fa timeout
52*8269e767SBrooks Davisis a non-NULL pointer, it specifies a maximum interval to wait for a
53*8269e767SBrooks Davisasynchronous I/O request to complete.
54*8269e767SBrooks DavisIf
55*8269e767SBrooks Davis.Fa timeout
56*8269e767SBrooks Davisis a NULL pointer,
57*8269e767SBrooks Davis.Fn aio_waitcomplete
58*8269e767SBrooks Daviswaits indefinitely.
59*8269e767SBrooks DavisTo effect a poll, the
60*8269e767SBrooks Davis.Fa timeout
61*8269e767SBrooks Davisargument should be non-NULL, pointing to a zero-valued timeval structure.
62*8269e767SBrooks Davis.Pp
63*8269e767SBrooks DavisThe
64*8269e767SBrooks Davis.Fn aio_waitcomplete
65*8269e767SBrooks Davissystem call also serves the function of
66*8269e767SBrooks Davis.Fn aio_return ,
67*8269e767SBrooks Davisthus
68*8269e767SBrooks Davis.Fn aio_return
69*8269e767SBrooks Davisshould not be called for the control block returned in
70*8269e767SBrooks Davis.Fa iocbp .
71*8269e767SBrooks Davis.Sh RETURN VALUES
72*8269e767SBrooks DavisIf an asynchronous I/O request has completed,
73*8269e767SBrooks Davis.Fa iocbp
74*8269e767SBrooks Davisis set to point to the control block passed with the original request,
75*8269e767SBrooks Davisand the status is returned as described in
76*8269e767SBrooks Davis.Xr read 2 ,
77*8269e767SBrooks Davis.Xr write 2 ,
78*8269e767SBrooks Davisor
79*8269e767SBrooks Davis.Xr fsync 2 .
80*8269e767SBrooks DavisOn failure,
81*8269e767SBrooks Davis.Fn aio_waitcomplete
82*8269e767SBrooks Davisreturns
83*8269e767SBrooks Davis.Dv -1 ,
84*8269e767SBrooks Davissets iocbp to
85*8269e767SBrooks Davis.Dv NULL
86*8269e767SBrooks Davisand sets
87*8269e767SBrooks Davis.Va errno
88*8269e767SBrooks Davisto indicate the error condition.
89*8269e767SBrooks Davis.Sh ERRORS
90*8269e767SBrooks DavisThe
91*8269e767SBrooks Davis.Fn aio_waitcomplete
92*8269e767SBrooks Davissystem call fails if:
93*8269e767SBrooks Davis.Bl -tag -width Er
94*8269e767SBrooks Davis.It Bq Er EINVAL
95*8269e767SBrooks DavisThe specified time limit is invalid.
96*8269e767SBrooks Davis.It Bq Er EAGAIN
97*8269e767SBrooks DavisThe process has not yet called
98*8269e767SBrooks Davis.Fn aio_read
99*8269e767SBrooks Davisor
100*8269e767SBrooks Davis.Fn aio_write .
101*8269e767SBrooks Davis.It Bq Er EINTR
102*8269e767SBrooks DavisA signal was delivered before the timeout expired and before any
103*8269e767SBrooks Davisasynchronous I/O requests completed.
104*8269e767SBrooks Davis.It Bq Er EWOULDBLOCK
105*8269e767SBrooks Davis.It Bq Er EINPROGRESS
106*8269e767SBrooks DavisThe specified time limit expired before any asynchronous I/O requests
107*8269e767SBrooks Daviscompleted.
108*8269e767SBrooks Davis.El
109*8269e767SBrooks Davis.Sh SEE ALSO
110*8269e767SBrooks Davis.Xr aio_cancel 2 ,
111*8269e767SBrooks Davis.Xr aio_error 2 ,
112*8269e767SBrooks Davis.Xr aio_read 2 ,
113*8269e767SBrooks Davis.Xr aio_return 2 ,
114*8269e767SBrooks Davis.Xr aio_suspend 2 ,
115*8269e767SBrooks Davis.Xr aio_write 2 ,
116*8269e767SBrooks Davis.Xr fsync 2 ,
117*8269e767SBrooks Davis.Xr read 2 ,
118*8269e767SBrooks Davis.Xr write 2 ,
119*8269e767SBrooks Davis.Xr aio 4
120*8269e767SBrooks Davis.Sh STANDARDS
121*8269e767SBrooks DavisThe
122*8269e767SBrooks Davis.Fn aio_waitcomplete
123*8269e767SBrooks Davissystem call is a
124*8269e767SBrooks Davis.Fx Ns -specific
125*8269e767SBrooks Davisextension.
126*8269e767SBrooks Davis.Sh HISTORY
127*8269e767SBrooks DavisThe
128*8269e767SBrooks Davis.Fn aio_waitcomplete
129*8269e767SBrooks Davissystem call first appeared in
130*8269e767SBrooks Davis.Fx 4.0 .
131*8269e767SBrooks Davis.Sh AUTHORS
132*8269e767SBrooks DavisThe
133*8269e767SBrooks Davis.Fn aio_waitcomplete
134*8269e767SBrooks Davissystem call and this manual page were written by
135*8269e767SBrooks Davis.An Christopher M Sedore Aq Mt cmsedore@maxwell.syr.edu .
136