Document chflagsat(2).

Obtained from:	jilles
This commit is contained in:
Pawel Jakub Dawidek 2013-03-21 23:05:44 +00:00
parent 5d46382415
commit 2883fbd521
3 changed files with 54 additions and 3 deletions

View File

@ -278,7 +278,8 @@ MLINKS+=cap_fcntls_limit.2 cap_fcntls_get.2
MLINKS+=cap_ioctls_limit.2 cap_ioctls_get.2
MLINKS+=cap_rights_limit.2 cap_rights_get.2
MLINKS+=chdir.2 fchdir.2
MLINKS+=chflags.2 fchflags.2 \
MLINKS+=chflags.2 chflagsat.2 \
chflags.2 fchflags.2 \
chflags.2 lchflags.2
MLINKS+=chmod.2 fchmod.2 \
chmod.2 fchmodat.2 \

View File

@ -159,7 +159,12 @@ Permit
.Xr fchdir 2 .
.It Dv CAP_FCHFLAGS
Permit
.Xr fchflags 2 .
.Xr fchflags 2
and
.Xr chflagsat 2 .
.It Dv CAP_CHFLAGSAT
An alias to
.Dv CAP_FCHFLAGS .
.It Dv CAP_FCHMOD
Permit
.Xr fchmod 2

View File

@ -28,7 +28,7 @@
.\" @(#)chflags.2 8.3 (Berkeley) 5/2/95
.\" $FreeBSD$
.\"
.Dd Apr 13, 2012
.Dd March 22, 2013
.Dt CHFLAGS 2
.Os
.Sh NAME
@ -47,6 +47,8 @@
.Fn lchflags "const char *path" "unsigned long flags"
.Ft int
.Fn fchflags "int fd" "unsigned long flags"
.Ft int
.Fn chflagsat "int fd" "const char *path" "unsigned long flags" "int atflag"
.Sh DESCRIPTION
The file whose name
is given by
@ -66,6 +68,45 @@ in which case
will change the flags of the link itself,
rather than the file it points to.
.Pp
The
.Fn chflagsat
is equivalent to either
.Fn chflags
or
.Fn lchflags
depending on the
.Fa atflag
except in the case where
.Fa path
specifies a relative path.
In this case the file to be changed is determined relative to the directory
associated with the file descriptor
.Fa fd
instead of the current working directory.
The values for the
.Fa atflag
are constructed by a bitwise-inclusive OR of flags from the following list,
defined in
.In fcntl.h :
.Bl -tag -width indent
.It Dv AT_SYMLINK_NOFOLLOW
If
.Fa path
names a symbolic link, then the flags of the symbolic link are changed.
.El
.Pp
If
.Fn chflagsat
is passed the special value
.Dv AT_FDCWD
in the
.Fa fd
parameter, the current working directory is used.
If also
.Fa atflag
is zero, the behavior is identical to a call to
.Fn chflags .
.Pp
The flags specified are formed by
.Em or Ns 'ing
the following values
@ -236,3 +277,7 @@ The
.Fn lchflags
system call first appeared in
.Fx 5.0 .
The
.Fn chflagsat
system call first appeared in
.Fx 10.0 .