3 .\" Copyright (c) 1996 Doug Rabson
5 .\" All rights reserved.
7 .\" This program is free software.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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.
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.
29 .\" $FreeBSD: src/share/man/man9/VOP_ATTRIB.9,v 1.9.2.2 2001/12/17 11:30:18 ru Exp $
30 .\" $DragonFly: src/share/man/man9/VOP_ATTRIB.9,v 1.2 2003/06/17 04:37:01 dillon Exp $
38 .Nd get and set attributes on a file or directory
43 .Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct proc *p"
45 .Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct proc *p"
47 These entry points manipulate various attributes of a file or directory,
48 including file permissions, owner, group, size,
49 access time and modification time.
56 the attributes of the file
58 the user credentials of the calling process
63 Attributes which are not being modified by
65 should be set to the value
69 expects the vnode to be locked on entry and will leave the vnode locked on
73 expects the vnode to be locked on entry and will leave the vnode locked on
77 returns information about the file in
80 returns zero if the attributes were changed successfully, otherwise an
81 appropriate error is returned.
85 vop_getattr(struct vnode *vp, struct vattr *vap,
86 struct ucred *cred, struct proc *p)
89 * Fill in the contents of *vap with information from
98 vop_setattr(struct vnode *vp, struct vattr *vap,
99 struct ucred *cred, struct proc *p)
102 * Check for unsettable attributes.
104 if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) ||
105 (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) ||
106 (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) ||
107 ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
111 if (vap->va_flags != VNOVAL) {
113 * Set the immutable and append flags of the file.
117 if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) {
119 * Change owner and/or group of the file.
123 if (vap->va_size != VNOVAL) {
125 * Truncate the file to the specified size.
129 if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
131 * Change access and/or modification time of file.
135 if (vap->va_mode != (mode_t)VNOVAL) {
137 * Change permissions of file.
147 The file is immutable
151 The filesystem is readonly
157 This man page was written by