1.\" $OpenBSD: vinvalbuf.9,v 1.5 2003/06/06 20:56:32 jmc Exp $ 2.\" 3.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice(s), this list of conditions and the following disclaimer as 10.\" the first lines of this file unmodified other than the possible 11.\" addition of one or more copyright notices. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice(s), this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 17.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26.\" DAMAGE. 27.\" 28.\" $FreeBSD: src/share/man/man9/vinvalbuf.9,v 1.6 2001/10/06 11:19:41 sheldonh Exp $ 29.\" 30.Dd July 7, 2001 31.Dt VINVALBUF 9 32.Os 33.Sh NAME 34.Nm vinvalbuf 35.Nd "flushes and invalidates all buffers associated with a vnode" 36.Sh SYNOPSIS 37.Fd #include <sys/param.h> 38.Fd #include <sys/vnode.h> 39.Ft int 40.Fn vinvalbuf "struct vnode *vp" "int flags" "struct ucred *cred" "struct proc *p" "int slpflag" "int slptimeo" 41.Sh DESCRIPTION 42The 43.Fn vinvalbuf 44function invalidates all of the buffers associated with the given vnode. 45This includes buffers on the clean list and the dirty list. 46If the 47.Dv V_SAVE 48flag is specified then the buffers on the dirty list are synced prior to being 49released. 50If the 51.Dv V_SAVEMETA 52flag is set, indirect blocks will not be flushed. 53.Pp 54Its arguments are: 55.Bl -tag -width ".Fa spltimeo" 56.It Fa vp 57A pointer to the vnode whose buffers will be invalidated. 58.It Fa flags 59The supported flags are 60.Dv V_SAVE 61and 62.Dv V_SAVEMETA . 63.Dv V_SAVE 64indicates that dirty buffers should be synced with the disk. 65.Dv V_SAVEMETA 66indicates the indirect blocks should not be flushed. 67.It Fa cred 68The user credentials that are used to 69.Xr VOP_FSYNC 9 70buffers if 71.Dv V_SAVE 72is set. 73.It Fa p 74The process responsible for this call. 75.It Fa slpflag 76The slp flag that will be used in the priority of any sleeps in the function. 77.It Fa slptimeo 78The timeout for any sleeps in the function. 79.El 80.Sh LOCKS 81The vnode is assumed to be locked prior to the call and remains locked upon 82return. 83.Sh RETURN VALUES 84A 0 value is returned on success. 85.Sh PSEUDOCODE 86.Bd -literal -offset indent 87vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); 88error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0); 89VOP_UNLOCK(devvp, 0, p); 90if (error) 91 return (error); 92.Ed 93.Sh ERRORS 94.Bl -tag -width Er 95.It Bq Er ENOSPC 96The file system is full. 97(With 98.Dv V_SAVE ) 99.It Bq Er EDQUOT 100Disc quota exceeded. 101(With 102.Dv V_SAVE ) 103.It Bq Er EWOULDBLOCK 104Sleep operation timed out. 105(See 106.Fa slptimeo ) 107.It Bq Er ERESTART 108A signal needs to be delivered and the system call should be restarted. 109(With 110.Dv PCATCH 111set in 112.Fa slpflag ) 113.It Bq Er EINTR 114The system has been interrupted by a signal. 115(With 116.Dv PCATCH 117set in 118.Fa slpflag ) 119.El 120.Sh SEE ALSO 121.Xr tsleep 9 122.Sh AUTHORS 123This man page was originally written by 124.An Chad David Aq davidc@acns.ab.ca 125for 126.Fx . 127