1.\" Copyright (c) 1989, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)chflags.2 8.3 (Berkeley) 5/2/95
| 1.\" Copyright (c) 1989, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)chflags.2 8.3 (Berkeley) 5/2/95
|
33.\" $FreeBSD: head/lib/libc/sys/chflags.2 74498 2001-03-19 23:51:09Z dd $
| 33.\" $FreeBSD: head/lib/libc/sys/chflags.2 77042 2001-05-23 14:58:19Z ru $
|
34.\" 35.Dd May 2, 1995 36.Dt CHFLAGS 2 37.Os 38.Sh NAME 39.Nm chflags , 40.Nm fchflags 41.Nd set file flags 42.Sh LIBRARY 43.Lb libc 44.Sh SYNOPSIS 45.Fd #include <sys/stat.h> 46.Fd #include <unistd.h> 47.Ft int 48.Fn chflags "const char *path" "u_long flags" 49.Ft int 50.Fn fchflags "int fd" "u_long flags" 51.Sh DESCRIPTION 52The file whose name 53is given by 54.Fa path 55or referenced by the descriptor 56.Fa fd 57has its flags changed to 58.Fa flags . 59.Pp 60The flags specified are formed by 61.Em or Ns 'ing 62the following values 63.Pp 64.Bl -tag -width "SF_IMMUTABLE" -compact -offset indent 65.It UF_NODUMP 66Do not dump the file. 67.It UF_IMMUTABLE 68The file may not be changed. 69.It UF_APPEND 70The file may only be appended to. 71.It UF_NOUNLINK 72The file may not be renamed or deleted. 73.It UF_OPAQUE 74The directory is opaque when viewed through a union stack. 75.It SF_ARCHIVED 76The file may be archived. 77.It SF_IMMUTABLE 78The file may not be changed. 79.It SF_APPEND 80The file may only be appended to. 81.It SF_NOUNLINK 82The file may not be renamed or deleted. 83.El 84.Pp 85The 86.Dq UF_IMMUTABLE , 87.Dq UF_APPEND , 88.Dq UF_NOUNLINK , 89.Dq UF_NODUMP , 90and 91.Dq UF_OPAQUE 92flags may be set or unset by either the owner of a file or the super-user. 93.Pp 94The 95.Dq SF_IMMUTABLE , 96.Dq SF_APPEND , 97.Dq SF_NOUNLINK , 98and 99.Dq SF_ARCHIVED 100flags may only be set or unset by the super-user. 101Attempts by the non-super-user to set the super-user only flags 102are silently ignored. 103These flags may be set at any time, but normally may only be unset when 104the system is in single-user mode. 105(See 106.Xr init 8 107for details.) 108.Sh RETURN VALUES 109Upon successful completion, a value of 0 is returned. 110Otherwise, -1 is returned and the global variable 111.Va errno 112is set to indicate the error. 113.Sh ERRORS 114.Fn Chflags 115will fail if: 116.Bl -tag -width Er 117.It Bq Er ENOTDIR 118A component of the path prefix is not a directory. 119.It Bq Er ENAMETOOLONG 120A component of a pathname exceeded 255 characters, 121or an entire path name exceeded 1023 characters. 122.It Bq Er ENOENT 123The named file does not exist. 124.It Bq Er EACCES 125Search permission is denied for a component of the path prefix. 126.It Bq Er ELOOP 127Too many symbolic links were encountered in translating the pathname. 128.It Bq Er EPERM 129The effective user ID does not match the owner of the file and 130the effective user ID is not the super-user. 131.It Bq Er EROFS 132The named file resides on a read-only file system. 133.It Bq Er EFAULT 134.Fa Path 135points outside the process's allocated address space. 136.It Bq Er EIO 137An 138.Tn I/O 139error occurred while reading from or writing to the file system. 140.It Bq Er EOPNOTSUPP 141The underlying file system does not support file flags. 142.El 143.Pp 144.Fn Fchflags 145will fail if: 146.Bl -tag -width Er 147.It Bq Er EBADF 148The descriptor is not valid. 149.It Bq Er EINVAL 150.Fa fd 151refers to a socket, not to a file. 152.It Bq Er EPERM 153The effective user ID does not match the owner of the file and 154the effective user ID is not the super-user. 155.It Bq Er EROFS 156The file resides on a read-only file system. 157.It Bq Er EIO 158An 159.Tn I/O 160error occurred while reading from or writing to the file system. 161.It Bq Er EOPNOTSUPP 162The underlying file system does not support file flags. 163.El 164.Sh SEE ALSO 165.Xr chflags 1 , 166.Xr fflagstostr 3 , 167.Xr strtofflags 3 , 168.Xr init 8 ,
| 34.\" 35.Dd May 2, 1995 36.Dt CHFLAGS 2 37.Os 38.Sh NAME 39.Nm chflags , 40.Nm fchflags 41.Nd set file flags 42.Sh LIBRARY 43.Lb libc 44.Sh SYNOPSIS 45.Fd #include <sys/stat.h> 46.Fd #include <unistd.h> 47.Ft int 48.Fn chflags "const char *path" "u_long flags" 49.Ft int 50.Fn fchflags "int fd" "u_long flags" 51.Sh DESCRIPTION 52The file whose name 53is given by 54.Fa path 55or referenced by the descriptor 56.Fa fd 57has its flags changed to 58.Fa flags . 59.Pp 60The flags specified are formed by 61.Em or Ns 'ing 62the following values 63.Pp 64.Bl -tag -width "SF_IMMUTABLE" -compact -offset indent 65.It UF_NODUMP 66Do not dump the file. 67.It UF_IMMUTABLE 68The file may not be changed. 69.It UF_APPEND 70The file may only be appended to. 71.It UF_NOUNLINK 72The file may not be renamed or deleted. 73.It UF_OPAQUE 74The directory is opaque when viewed through a union stack. 75.It SF_ARCHIVED 76The file may be archived. 77.It SF_IMMUTABLE 78The file may not be changed. 79.It SF_APPEND 80The file may only be appended to. 81.It SF_NOUNLINK 82The file may not be renamed or deleted. 83.El 84.Pp 85The 86.Dq UF_IMMUTABLE , 87.Dq UF_APPEND , 88.Dq UF_NOUNLINK , 89.Dq UF_NODUMP , 90and 91.Dq UF_OPAQUE 92flags may be set or unset by either the owner of a file or the super-user. 93.Pp 94The 95.Dq SF_IMMUTABLE , 96.Dq SF_APPEND , 97.Dq SF_NOUNLINK , 98and 99.Dq SF_ARCHIVED 100flags may only be set or unset by the super-user. 101Attempts by the non-super-user to set the super-user only flags 102are silently ignored. 103These flags may be set at any time, but normally may only be unset when 104the system is in single-user mode. 105(See 106.Xr init 8 107for details.) 108.Sh RETURN VALUES 109Upon successful completion, a value of 0 is returned. 110Otherwise, -1 is returned and the global variable 111.Va errno 112is set to indicate the error. 113.Sh ERRORS 114.Fn Chflags 115will fail if: 116.Bl -tag -width Er 117.It Bq Er ENOTDIR 118A component of the path prefix is not a directory. 119.It Bq Er ENAMETOOLONG 120A component of a pathname exceeded 255 characters, 121or an entire path name exceeded 1023 characters. 122.It Bq Er ENOENT 123The named file does not exist. 124.It Bq Er EACCES 125Search permission is denied for a component of the path prefix. 126.It Bq Er ELOOP 127Too many symbolic links were encountered in translating the pathname. 128.It Bq Er EPERM 129The effective user ID does not match the owner of the file and 130the effective user ID is not the super-user. 131.It Bq Er EROFS 132The named file resides on a read-only file system. 133.It Bq Er EFAULT 134.Fa Path 135points outside the process's allocated address space. 136.It Bq Er EIO 137An 138.Tn I/O 139error occurred while reading from or writing to the file system. 140.It Bq Er EOPNOTSUPP 141The underlying file system does not support file flags. 142.El 143.Pp 144.Fn Fchflags 145will fail if: 146.Bl -tag -width Er 147.It Bq Er EBADF 148The descriptor is not valid. 149.It Bq Er EINVAL 150.Fa fd 151refers to a socket, not to a file. 152.It Bq Er EPERM 153The effective user ID does not match the owner of the file and 154the effective user ID is not the super-user. 155.It Bq Er EROFS 156The file resides on a read-only file system. 157.It Bq Er EIO 158An 159.Tn I/O 160error occurred while reading from or writing to the file system. 161.It Bq Er EOPNOTSUPP 162The underlying file system does not support file flags. 163.El 164.Sh SEE ALSO 165.Xr chflags 1 , 166.Xr fflagstostr 3 , 167.Xr strtofflags 3 , 168.Xr init 8 ,
|
169.Xr mount_union 8
| 169.Xr mount_unionfs 8
|
170.Sh HISTORY 171The 172.Nm chflags 173and 174.Nm fchflags 175functions first appeared in 176.Bx 4.4 .
| 170.Sh HISTORY 171The 172.Nm chflags 173and 174.Nm fchflags 175functions first appeared in 176.Bx 4.4 .
|