xref: /openbsd/share/man/man9/vwaitforio.9 (revision 9b7c3dbb)
1.\"     $OpenBSD: vwaitforio.9,v 1.14 2015/09/14 15:14:55 schwarze Exp $
2.\"
3.\" Copyright (c) 2001 Constantine Sapuntzakis
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. The name of the author may not be used to endorse or promote products
13.\"    derived from this software without specific prior written permission.
14.\"
15.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19.\" EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.Dd $Mdocdate: September 14 2015 $
27.Dt VWAITFORIO 9
28.Os
29.Sh NAME
30.Nm vwaitforio
31.Nd wait for all outstanding asynchronous writes
32.Sh SYNOPSIS
33.In sys/types.h
34.In sys/vnode.h
35.Ft int
36.Fn vwaitforio "struct vnode *vp" "int slpflag" "char *wmesg" "int slptimeo"
37.Sh DESCRIPTION
38The
39.Fn vwaitforio
40call sleeps until all asynchronous writes associated with the vnode
41.Fa vp
42finish.
43This is used by functions that need to make sure
44that the writes they initiated have completed.
45.Pp
46The
47.Fn vwaitforio
48call sleeps at priority
49.Dv PRIBIO
50+ 1 .
51The
52.Fa slpflag ,
53.Fa wmesg ,
54and
55.Fa slptimeo
56arguments indicate flags to be passed to
57.Xr tsleep 9 .
58.Pp
59This function must be called at
60.Xr splbio 9 .
61.Pp
62It may be important to ensure that no other process submits asynchronous
63writes while a process is waiting for I/O on this vnode.
64Otherwise,
65.Fn vwaitforio
66may never return.
67.Sh RETURN VALUES
68The
69.Fn vwaitforio
70function returns 0 on success.
71See
72.Xr tsleep 9
73for possible error returns.
74.Sh SEE ALSO
75.Xr tsleep 9 ,
76.Xr vnode 9
77