1CHFLAGS(2) System Calls Manual CHFLAGS(2)
2
3
4
6 chflags, fchflags - set file flags
7
9 #include <sys/stat.h>
10
11 int
12 chflags(path, flags)
13 char *path;
14 u_short flags;
15
16 int
17 fchflags(fd, flags)
18 int fd;
19 u_short flags;
20
22 The file whose name is given by path or referenced by the descriptor fd
23 has its flags changed to flags .
24
25 The flags specified are formed by or'ing the following values
26
27 UF_NODUMP Do not dump the file.
28
29 UF_IMMUTABLE The file may not be changed.
30
31 UF_APPEND The file may only be appended to.
32
33 ARCHIVED File is archived.
34
35 SF_IMMUTABLE The file may not be changed.
36
37 SF_APPEND The file may only be appended to.
38
39 The UF_IMMUTABLE and UF_APPEND flags may be set or unset by either the
40 owner of a file or the super-user.
41
42 The SF_IMMUTABLE and SF_APPEND flags may only be set or unset by the
43 super-user. They may be set at any time, but normally may only be
44 unset when the system is in single-user mode. (See init(8) for
45 details.)
46
48 Upon successful completion, a value of 0 is returned. Otherwise, -1 is
49 returned and the global variable errno is set to indicate the error.
50
52 Chflags will fail if:
53
54 ENOTDIR A component of the path prefix is not a directory.
55
56 EINVAL The pathname contains a character with the high-order
57 bit set.
58
59 ENAMETOOLONG A component of a pathname exceeded 63 characters, or an
60 entire path name exceeded 255 characters.
61
62 ENOENT The named file does not exist.
63
64 EACCES Search permission is denied for a component of the path
65 prefix.
66
67 ELOOP Too many symbolic links were encountered in translating
68 the pathname.
69
70 EPERM The effective user ID does not match the owner of the
71 file and the effective user ID is not the super-user.
72
73 EROFS The named file resides on a read-only file system.
74
75 EFAULT path points outside the process's allocated address
76 space.
77
78 EIO An I/O error occurred while reading from or writing to
79 the file system.
80
81 fchflags will fail if:
82
83 EBADF The descriptor is not valid.
84
85 EINVAL fd refers to a socket, not to a file.
86
87 EPERM The effective user ID does not match the owner of the
88 file and the effective user ID is not the super-user.
89
90 EROFS The file resides on a read-only file system.
91
92 EIO An I/O error occurred while reading from or writing to
93 the file system.
94
96 chflags(1), init(8)
97
99 The chflags and fchflags functions first appeared in 4.4BSD.
100
101
102
1034th Berkeley Distribution November 28, 1994 CHFLAGS(2)