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