xref: /freebsd/share/man/man9/VOP_ATTRIB.9 (revision 41059135ce931c0f1014a999ffabc6bc470ce856)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 1996 Doug Rabson
4.\"
5.\" All rights reserved.
6.\"
7.\" This program is free software.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\" $FreeBSD$
30.\"
31.Dd August 29, 2008
32.Dt VOP_ATTRIB 9
33.Os
34.Sh NAME
35.Nm VOP_GETATTR ,
36.Nm VOP_SETATTR
37.Nd get and set attributes on a file or directory
38.Sh SYNOPSIS
39.In sys/param.h
40.In sys/vnode.h
41.Ft int
42.Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
43.Ft int
44.Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
45.Sh DESCRIPTION
46These entry points manipulate various attributes of a file or directory,
47including file permissions, owner, group, size,
48access time and modification time.
49.Pp
50The arguments are:
51.Bl -tag -width cred
52.It Fa vp
53The vnode of the file.
54.It Fa vap
55The attributes of the file.
56.It Fa cred
57The user credentials of the calling process.
58.El
59.Pp
60Attributes which are not being modified by
61.Fn VOP_SETATTR
62should be set to the value
63.Dv VNOVAL ;
64.Fn VATTR_NULL
65may be used to clear all the values, and should generally be used to reset
66the contents of
67.Fa *vap
68prior to setting specific values.
69.Sh LOCKS
70.Fn VOP_GETATTR
71expects the vnode to be locked on entry and will leave the vnode locked on
72return.
73The lock type can be either shared or exclusive.
74.Pp
75.Fn VOP_SETATTR
76expects the vnode to be locked on entry and will leave the vnode locked on
77return.
78The lock type must be exclusive.
79.Sh RETURN VALUES
80.Fn VOP_GETATTR
81returns 0 if it was able to retrieve the attribute data via
82.Fa *vap ,
83otherwise an appropriate error is returned.
84.Fn VOP_SETATTR
85returns zero if the attributes were changed successfully, otherwise an
86appropriate error is returned.
87.Sh ERRORS
88.Bl -tag -width Er
89.It Bq Er EPERM
90The file is immutable.
91.It Bq Er EACCES
92The caller does not have permission to modify the file or directory attributes.
93.It Bq Er EROFS
94The file system is read-only.
95.El
96.Sh SEE ALSO
97.Xr VFS 9 ,
98.Xr vnode 9 ,
99.Xr VOP_ACCESS 9
100.Sh AUTHORS
101This manual page was written by
102.An Doug Rabson .
103