Commit | Line | Data |
---|---|---|
c334d3e6 KM |
1 | .\" Copyright (c) 1989 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
faf7e3e0 | 4 | .\" %sccs.include.redist.roff% |
c334d3e6 | 5 | .\" |
66a33ad7 | 6 | .\" @(#)chflags.2 6.6 (Berkeley) %G% |
c334d3e6 | 7 | .\" |
931b8415 | 8 | .Dd |
66a33ad7 | 9 | .Dt CHFLAGS 2 |
faf7e3e0 | 10 | .Os |
931b8415 CL |
11 | .Sh NAME |
12 | .Nm chflags , | |
13 | .Nm fchflags | |
14 | .Nd set file flags | |
15 | .Sh SYNOPSIS | |
16 | .Fd #include <unistd.h> | |
17 | .Ft int | |
18 | .Fn chflags "const char *path" "long flags" | |
19 | .Ft int | |
20 | .Fn fchflags "int fd" "long flags" | |
21 | .Sh DESCRIPTION | |
c334d3e6 | 22 | The file whose name |
931b8415 CL |
23 | is given by |
24 | .Fa path | |
c334d3e6 | 25 | or referenced by the descriptor |
931b8415 | 26 | .Fa fd |
c334d3e6 | 27 | has its flags changed to |
931b8415 CL |
28 | .Fa flags . |
29 | .Pp | |
c334d3e6 KM |
30 | Only the owner of a file (or the super-user) may change the flags. |
31 | The owner may only change the lower 16 bits of the flags; | |
32 | the super-user may change all 32 bits of the flags. | |
931b8415 | 33 | .Sh RETURN VALUES |
c334d3e6 | 34 | Upon successful completion, a value of 0 is returned. |
931b8415 CL |
35 | Otherwise, -1 is returned and the global variable |
36 | .Va errno | |
c334d3e6 | 37 | is set to indicate the error. |
931b8415 CL |
38 | .Sh ERRORS |
39 | .Fn Chflags | |
40 | fails if: | |
41 | .Bl -tag -width Er | |
42 | .It Bq Er ENOTDIR | |
c334d3e6 | 43 | A component of the path prefix is not a directory. |
931b8415 | 44 | .It Bq Er EINVAL |
c334d3e6 | 45 | The pathname contains a character with the high-order bit set. |
931b8415 | 46 | .It Bq Er ENAMETOOLONG |
c334d3e6 KM |
47 | A component of a pathname exceeded 255 characters, |
48 | or an entire path name exceeded 1023 characters. | |
931b8415 | 49 | .It Bq Er ENOENT |
c334d3e6 | 50 | The named file does not exist. |
931b8415 | 51 | .It Bq Er EACCES |
c334d3e6 | 52 | Search permission is denied for a component of the path prefix. |
931b8415 | 53 | .It Bq Er ELOOP |
c334d3e6 | 54 | Too many symbolic links were encountered in translating the pathname. |
931b8415 | 55 | .It Bq Er EPERM |
c334d3e6 KM |
56 | The effective user ID does not match the owner of the file and |
57 | the effective user ID is not the super-user. | |
931b8415 | 58 | .It Bq Er EROFS |
c334d3e6 | 59 | The named file resides on a read-only file system. |
931b8415 CL |
60 | .It Bq Er EFAULT |
61 | .Fa Path | |
c334d3e6 | 62 | points outside the process's allocated address space. |
931b8415 | 63 | .It Bq Er EIO |
faf7e3e0 CL |
64 | An |
65 | .Tn I/O | |
66 | error occurred while reading from or writing to the file system. | |
931b8415 CL |
67 | .El |
68 | .Pp | |
69 | .Fn Fchflags | |
c334d3e6 | 70 | will fail if: |
931b8415 CL |
71 | .Bl -tag -width Er |
72 | .It Bq Er EBADF | |
c334d3e6 | 73 | The descriptor is not valid. |
931b8415 CL |
74 | .It Bq Er EINVAL |
75 | .Fa Fd | |
c334d3e6 | 76 | refers to a socket, not to a file. |
931b8415 | 77 | .It Bq Er EPERM |
c334d3e6 KM |
78 | The effective user ID does not match the owner of the file and |
79 | the effective user ID is not the super-user. | |
931b8415 | 80 | .It Bq Er EROFS |
c334d3e6 | 81 | The file resides on a read-only file system. |
931b8415 | 82 | .It Bq Er EIO |
faf7e3e0 CL |
83 | An |
84 | .Tn I/O | |
85 | error occurred while reading from or writing to the file system. | |
931b8415 CL |
86 | .El |
87 | .Sh SEE ALSO | |
88 | .Xr chmod 2 , | |
89 | .Xr open 2 , | |
90 | .Xr chown 2 , | |
91 | .Xr stat 2 | |
92 | .Sh HISTORY | |
93 | The | |
faf7e3e0 CL |
94 | .Nm chflags |
95 | and | |
96 | .Nm fchflags | |
97 | function calls are | |
98 | .Ud . |