1.\" $OpenBSD: vget.9,v 1.8 2007/05/31 19:20:01 jmc Exp $ 2.\" -*- nroff -*- 3.\" 4.\" Copyright (c) 1996 Doug Rabson 5.\" 6.\" All rights reserved. 7.\" 8.\" This program is free software. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29.\" 30.\" $FreeBSD: src/share/man/man9/vget.9,v 1.7 2001/12/26 23:14:04 davidc Exp $ 31.\" 32.Dd $Mdocdate: May 31 2007 $ 33.Os 34.Dt VGET 9 35.Sh NAME 36.Nm vget 37.Nd get a vnode from the free list 38.Sh SYNOPSIS 39.Fd #include <sys/param.h> 40.Fd #include <sys/vnode.h> 41.Ft int 42.Fn vget "struct vnode *vp" "int flags" "struct proc *p" 43.Sh DESCRIPTION 44Get a vnode from the free list and increment its reference count. 45.Pp 46Its arguments are: 47.Bl -tag -width flags 48.It Fa vp 49The vnode to remove from the free list. 50.It Fa flags 51If non-zero, the vnode will also be locked. 52.It Fa p 53The process responsible for this call. 54.El 55.Pp 56When not in use, vnodes are kept on a free list. 57The vnodes still 58reference valid files but may be reused to refer to a new file at any 59time. 60Often, these vnodes are also held in caches in the system, such 61as the name cache. 62.Pp 63When a vnode which is on the free list is used again, for instance if 64the vnode was found in the name cache as a result of a call to 65.Xr VOP_LOOKUP 9 , 66then the new user must call 67.Fn vget 68to increment the reference count and remove it from the free list. 69.Sh ERRORS 70.Bl -tag -width Er 71.It Bq Er ENOENT 72The vnode 73.Fa vp 74is in the process of being cleaned out from the underlying 75file system. 76.It Bq Er EBUSY 77The vnode 78.Fa vp 79is in the process of being cleaned out from the underlying file system, and 80it wasn't possible to sleep on it because the 81.Dv LK_NOWAIT 82flag was specified. 83.El 84.Sh SEE ALSO 85.Xr vnode 9 , 86.Xr vput 9 , 87.Xr vref 9 , 88.Xr vrele 9 89.Sh AUTHORS 90This man page was originally written by 91.An Doug Rabson 92for 93.Fx . 94