date and time created 89/07/02 20:11:52 by mckusick
[unix-history] / usr / src / lib / libc / sys / chflags.2
CommitLineData
c334d3e6
KM
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15.\"
16.\" @(#)chflags.2 6.1 (Berkeley) %G%
17.\"
18.TH CHFALGS 2 ""
19.UC 7
20.SH NAME
21chflags, fchflags \- set file flags
22.SH SYNOPSIS
23.nf
24.ft B
25chflags(path, flags)
26char *path;
27long flags;
28.LP
29.ft B
30fchflags(fd, flags)
31int fd;
32long flags;
33.fi
34.ft R
35.SH DESCRIPTION
36The file whose name
37is given by \fIpath\fP
38or referenced by the descriptor
39.I fd
40has its flags changed to
41.IR flags .
42.PP
43Only the owner of a file (or the super-user) may change the flags.
44The owner may only change the lower 16 bits of the flags;
45the super-user may change all 32 bits of the flags.
46.SH RETURN VALUE
47Upon successful completion, a value of 0 is returned.
48Otherwise, \-1 is returned and the global variable
49.I errno
50is set to indicate the error.
51.SH ERRORS
52.I Chflags
53fails if one or more of the following are true:
54.TP 15
55[ENOTDIR]
56A component of the path prefix is not a directory.
57.TP 15
58[EINVAL]
59The pathname contains a character with the high-order bit set.
60.TP 15
61[ENAMETOOLONG]
62A component of a pathname exceeded 255 characters,
63or an entire path name exceeded 1023 characters.
64.TP 15
65[ENOENT]
66The named file does not exist.
67.TP 15
68[EACCES]
69Search permission is denied for a component of the path prefix.
70.TP 15
71[ELOOP]
72Too many symbolic links were encountered in translating the pathname.
73.TP 15
74[EPERM]
75The effective user ID does not match the owner of the file and
76the effective user ID is not the super-user.
77.TP 15
78[EROFS]
79The named file resides on a read-only file system.
80.TP 15
81[EFAULT]
82.I Path
83points outside the process's allocated address space.
84.TP 15
85[EIO]
86An I/O error occurred while reading from or writing to the file system.
87.PP
88.I Fchmod
89will fail if:
90.TP 15
91[EBADF]
92The descriptor is not valid.
93.TP 15
94[EINVAL]
95.I Fd
96refers to a socket, not to a file.
97.TP 15
98[EPERM]
99The effective user ID does not match the owner of the file and
100the effective user ID is not the super-user.
101.TP 15
102[EROFS]
103The file resides on a read-only file system.
104.TP 15
105[EIO]
106An I/O error occurred while reading from or writing to the file system.
107.SH "SEE ALSO"
108chmod(2), open(2), chown(2), stat(2)