1.\" $OpenBSD: vwaitforio.9,v 1.16 2019/07/19 00:54:58 cheloha 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: July 19 2019 $ 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.Fo vwaitforio 37.Fa "struct vnode *vp" 38.Fa "int slpflag" 39.Fa "char *wmesg" 40.Fa "uint64_t slptimeo" 41.Fc 42.Sh DESCRIPTION 43The 44.Fn vwaitforio 45call sleeps until all asynchronous writes associated with the vnode 46.Fa vp 47finish. 48This is used by functions that need to make sure 49that the writes they initiated have completed. 50.Pp 51The 52.Fn vwaitforio 53call sleeps at priority 54.Dv PRIBIO 55+ 1. 56The 57.Fa slpflag , 58.Fa wmesg , 59and 60.Fa slptimeo 61arguments indicate flags to be passed to 62.Xr tsleep_nsec 9 . 63.Pp 64This function must be called at 65.Xr splbio 9 . 66.Pp 67It may be important to ensure that no other process submits asynchronous 68writes while a process is waiting for I/O on this vnode. 69Otherwise, 70.Fn vwaitforio 71may never return. 72.Sh RETURN VALUES 73The 74.Fn vwaitforio 75function returns 0 on success. 76See 77.Xr tsleep 9 78for possible error returns. 79.Sh SEE ALSO 80.Xr tsleep 9 , 81.Xr vnode 9 82