summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2013-03-21 23:05:44 +0000
committerpjd <pjd@FreeBSD.org>2013-03-21 23:05:44 +0000
commit01401cc9bca76c460248a40ae70d0c23f8df2e2a (patch)
tree461bfd0573ec3a7593e6d127b869ad113b8b3127 /lib
parentf44b21d5e5a136e80abf599ed9aecba92339234b (diff)
downloadFreeBSD-src-01401cc9bca76c460248a40ae70d0c23f8df2e2a.zip
FreeBSD-src-01401cc9bca76c460248a40ae70d0c23f8df2e2a.tar.gz
Document chflagsat(2).
Obtained from: jilles
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/Makefile.inc3
-rw-r--r--lib/libc/sys/cap_rights_limit.27
-rw-r--r--lib/libc/sys/chflags.247
3 files changed, 54 insertions, 3 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 62aab6c..fef0f3c 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -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 \
diff --git a/lib/libc/sys/cap_rights_limit.2 b/lib/libc/sys/cap_rights_limit.2
index d0605af..2e18dd2 100644
--- a/lib/libc/sys/cap_rights_limit.2
+++ b/lib/libc/sys/cap_rights_limit.2
@@ -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
diff --git a/lib/libc/sys/chflags.2 b/lib/libc/sys/chflags.2
index 51c3cf7..5bc2ba2 100644
--- a/lib/libc/sys/chflags.2
+++ b/lib/libc/sys/chflags.2
@@ -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 .
OpenPOWER on IntegriCloud