xref: /openbsd-src/share/man/man9/vref.9 (revision dddd2645fd99df9cea4bd12d510ca892fff2f643)
1*dddd2645Sschwarze.\"     $OpenBSD: vref.9,v 1.8 2013/06/04 19:27:17 schwarze Exp $
2ac0b1781Scsapuntz.\"
3ac0b1781Scsapuntz.\" Copyright (c) 1996 Doug Rabson
4ac0b1781Scsapuntz.\"
5ac0b1781Scsapuntz.\" All rights reserved.
6ac0b1781Scsapuntz.\"
7ac0b1781Scsapuntz.\" This program is free software.
8ac0b1781Scsapuntz.\"
9ac0b1781Scsapuntz.\" Redistribution and use in source and binary forms, with or without
10ac0b1781Scsapuntz.\" modification, are permitted provided that the following conditions
11ac0b1781Scsapuntz.\" are met:
12ac0b1781Scsapuntz.\" 1. Redistributions of source code must retain the above copyright
13ac0b1781Scsapuntz.\"    notice, this list of conditions and the following disclaimer.
14ac0b1781Scsapuntz.\" 2. Redistributions in binary form must reproduce the above copyright
15ac0b1781Scsapuntz.\"    notice, this list of conditions and the following disclaimer in the
16ac0b1781Scsapuntz.\"    documentation and/or other materials provided with the distribution.
17ac0b1781Scsapuntz.\"
18ac0b1781Scsapuntz.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19ac0b1781Scsapuntz.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20ac0b1781Scsapuntz.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21ac0b1781Scsapuntz.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22ac0b1781Scsapuntz.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23ac0b1781Scsapuntz.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24ac0b1781Scsapuntz.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25ac0b1781Scsapuntz.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26ac0b1781Scsapuntz.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27ac0b1781Scsapuntz.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28ac0b1781Scsapuntz.\"
29ac0b1781Scsapuntz.\" $FreeBSD: src/share/man/man9/vref.9,v 1.8 2001/10/01 16:09:25 ru Exp $
30ac0b1781Scsapuntz.\"
31*dddd2645Sschwarze.Dd $Mdocdate: June 4 2013 $
32ac0b1781Scsapuntz.Dt VREF 9
33b00e7293Sjmc.Os
34ac0b1781Scsapuntz.Sh NAME
35ac0b1781Scsapuntz.Nm vref
36ac0b1781Scsapuntz.Nd increment the use count for a vnode
37ac0b1781Scsapuntz.Sh SYNOPSIS
38*dddd2645Sschwarze.In sys/param.h
39*dddd2645Sschwarze.In sys/vnode.h
40ac0b1781Scsapuntz.Ft void
41ac0b1781Scsapuntz.Fn vref "struct vnode *vp"
42ac0b1781Scsapuntz.Sh DESCRIPTION
43ac0b1781ScsapuntzIncrement the
44db5918d3Sjmc.Va v_usecount
45db5918d3Sjmcfield of the vnode specified by
46db5918d3Sjmc.Fa vp .
47ac0b1781Scsapuntz.Pp
48ac0b1781ScsapuntzEach vnode maintains a reference count of how many parts of the system
494c8a7c32Smpechare using the vnode.
504c8a7c32SmpechThis allows the system to detect when a vnode is
51ac0b1781Scsapuntzno longer being used and can be safely recycled for a different file.
52ac0b1781Scsapuntz.Pp
53db5918d3SjmcAny code in the system which uses a vnode (e.g. during the
54ac0b1781Scsapuntzoperation of some algorithm or to store in a data structure) should
55ac0b1781Scsapuntzcall
56601d79cdSjmc.Fn vref .
57ac0b1781Scsapuntz.Sh SEE ALSO
58ac0b1781Scsapuntz.Xr vget 9 ,
59ac0b1781Scsapuntz.Xr vnode 9 ,
60ac0b1781Scsapuntz.Xr vput 9 ,
61ac0b1781Scsapuntz.Xr vrele 9
62ac0b1781Scsapuntz.Sh AUTHORS
63ac0b1781ScsapuntzThis man page was originally written by
64ac0b1781Scsapuntz.An Doug Rabson
654c8a7c32Smpechfor
664c8a7c32Smpech.Fx .
67