p The flags specified are formed by .Em or Ns 'ing the following values:
p l -tag -width "SF_IMMUTABLE" -compact -offset indent t Dv UF_NODUMP Do not dump the file. t Dv UF_IMMUTABLE The file may not be changed. t Dv UF_APPEND The file may only be appended to. t Dv UF_OPAQUE The file (if a directory) is opaque for union mounts. t Dv SF_ARCHIVED The file is archived. t Dv SF_IMMUTABLE The file may not be changed. t Dv SF_APPEND The file may only be appended to. .El
p The .Dv UF_NODUMP , .Dv UF_IMMUTABLE , .Dv UF_APPEND , and .Dv UF_OPAQUE flags may be set or unset by either the owner of a file or the super-user, except on block and character devices, where only the super-user may set or unset them.
p The .Dv SF_ARCHIVED , .Dv SF_IMMUTABLE , and .Dv SF_APPEND flags may only be set or unset by the super-user. These flags may be set at any time, but normally may only be unset when the system is in single-user mode. (See .Xr init 8 for details.) .Sh RETURN VALUES Upon successful completion, a value of 0 is returned. Otherwise, -1 is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS .Fn chflags will fail if: l -tag -width Er t Bq Er ENOTDIR A component of the path prefix is not a directory. t Bq Er ENAMETOOLONG A component of a pathname exceeded rq Dv NAME_MAX characters, or an entire path name exceeded rq Dv PATH_MAX characters. t Bq Er ENOENT The named file does not exist. t Bq Er EACCES Search permission is denied for a component of the path prefix. t Bq Er ELOOP Too many symbolic links were encountered in translating the pathname. t Bq Er EPERM The effective user ID does not match the owner of the file and the effective user ID is not the super-user, or the effective user ID is not the super-user and one or more of the super-user-only flags for the named file would be changed. t Bq Er EOPNOTSUPP The named file resides on a file system that does not support file flags. t Bq Er EROFS The named file resides on a read-only file system. t Bq Er EFAULT .Fa path points outside the process's allocated address space. t Bq Er EIO An .Tn I/O error occurred while reading from or writing to the file system. .El
p .Fn fchflags will fail if: l -tag -width Er t Bq Er EBADF The descriptor is not valid. t Bq Er EINVAL .Fa fd refers to a socket, not to a file. t Bq Er EPERM The effective user ID does not match the owner of the file and the effective user ID is not the super-user, or the effective user ID is not the super-user and one or more of the super-user-only flags for the file would be changed. t Bq Er EOPNOTSUPP The file resides on a file system that does not support file flags. t Bq Er EROFS The file resides on a read-only file system. t Bq Er EIO An .Tn I/O error occurred while reading from or writing to the file system. .El .Sh SEE ALSO .Xr chflags 1 , .Xr stat 2 , .Xr stat_flags 3 , .Xr init 8 , .Xr mount_union 8 .Sh HISTORY The .Fn chflags and .Fn fchflags functions first appeared in x 4.4 . The .Fn lchflags function first appeared in .Nx 1.5 .