Date: Thu, 21 Mar 2013 23:05:44 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248601 - head/lib/libc/sys Message-ID: <201303212305.r2LN5irO064669@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Thu Mar 21 23:05:44 2013 New Revision: 248601 URL: http://svnweb.freebsd.org/changeset/base/248601 Log: Document chflagsat(2). Obtained from: jilles Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/cap_rights_limit.2 head/lib/libc/sys/chflags.2 Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Thu Mar 21 23:02:19 2013 (r248600) +++ head/lib/libc/sys/Makefile.inc Thu Mar 21 23:05:44 2013 (r248601) @@ -278,7 +278,8 @@ MLINKS+=cap_fcntls_limit.2 cap_fcntls_ge 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 \ Modified: head/lib/libc/sys/cap_rights_limit.2 ============================================================================== --- head/lib/libc/sys/cap_rights_limit.2 Thu Mar 21 23:02:19 2013 (r248600) +++ head/lib/libc/sys/cap_rights_limit.2 Thu Mar 21 23:05:44 2013 (r248601) @@ -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 Modified: head/lib/libc/sys/chflags.2 ============================================================================== --- head/lib/libc/sys/chflags.2 Thu Mar 21 23:02:19 2013 (r248600) +++ head/lib/libc/sys/chflags.2 Thu Mar 21 23:05:44 2013 (r248601) @@ -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 .
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303212305.r2LN5irO064669>