summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2009-07-08 15:23:18 +0000
committertrasz <trasz@FreeBSD.org>2009-07-08 15:23:18 +0000
commit09784497a28d12cd83a37f13a040e4ad325ef692 (patch)
treee525a39d82e8f09edff07a5f34dbc91455121d99 /lib
parent82187ebf4442997e887a1eb21292f91962a323e1 (diff)
downloadFreeBSD-src-09784497a28d12cd83a37f13a040e4ad325ef692.zip
FreeBSD-src-09784497a28d12cd83a37f13a040e4ad325ef692.tar.gz
There is an optimization in chmod(1), that makes it not to call chmod(2)
if the new file mode is the same as it was before; however, this optimization must be disabled for filesystems that support NFSv4 ACLs. Chmod uses pathconf(2) to determine whether this is the case - however, pathconf(2) always follows symbolic links, while the 'chmod -h' doesn't. This change adds lpathconf(3) to make it possible to solve that problem in a clean way. Reviewed by: rwatson (earlier version) Approved by: re (kib)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/Makefile.inc1
-rw-r--r--lib/libc/sys/Symbol.map1
-rw-r--r--lib/libc/sys/pathconf.228
3 files changed, 27 insertions, 3 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index ad6b06e..da4f3c5 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -159,6 +159,7 @@ MLINKS+=mq_send.2 mq_timedsend.2
MLINKS+=ntp_adjtime.2 ntp_gettime.2
MLINKS+=open.2 openat.2
MLINKS+=pathconf.2 fpathconf.2
+MLINKS+=pathconf.2 lpathconf.2
MLINKS+=read.2 pread.2 read.2 preadv.2 read.2 readv.2
MLINKS+=readlink.2 readlinkat.2
MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index 88bc779..901b261 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -346,6 +346,7 @@ FBSD_1.1 {
jail_set;
jail_remove;
linkat;
+ lpathconf;
mkdirat;
mkfifoat;
mknodat;
diff --git a/lib/libc/sys/pathconf.2 b/lib/libc/sys/pathconf.2
index daf95ab..495bc65 100644
--- a/lib/libc/sys/pathconf.2
+++ b/lib/libc/sys/pathconf.2
@@ -28,11 +28,12 @@
.\" @(#)pathconf.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 25, 2009
+.Dd July 7, 2009
.Dt PATHCONF 2
.Os
.Sh NAME
.Nm pathconf ,
+.Nm lpathconf ,
.Nm fpathconf
.Nd get configurable pathname variables
.Sh LIBRARY
@@ -42,10 +43,13 @@
.Ft long
.Fn pathconf "const char *path" "int name"
.Ft long
+.Fn lpathconf "const char *path" "int name"
+.Ft long
.Fn fpathconf "int fd" "int name"
.Sh DESCRIPTION
The
-.Fn pathconf
+.Fn pathconf ,
+.Fn lpathconf
and
.Fn fpathconf
system calls provide a method for applications to determine the current
@@ -53,7 +57,9 @@ value of a configurable system limit or option variable associated
with a pathname or file descriptor.
.Pp
For
-.Fn pathconf ,
+.Fn pathconf
+and
+.Fn lpathconf ,
the
.Fa path
argument is the name of a file or directory.
@@ -68,6 +74,18 @@ argument specifies the system variable to be queried.
Symbolic constants for each name value are found in the include file
.Li <unistd.h> .
.Pp
+The
+.Fn lpathconf
+system call is like
+.Fn pathconf
+except in the case where the named file is a symbolic link,
+in which case
+.Fn lpathconf
+returns information about the link,
+while
+.Fn pathconf
+returns information about the file the link references.
+.Pp
The available values are as follows:
.Pp
.Bl -tag -width 6n
@@ -239,3 +257,7 @@ and
.Fn fpathconf
system calls first appeared in
.Bx 4.4 .
+The
+.Fn lpathconf
+system call first appeared in
+.Fx 8.0 .
OpenPOWER on IntegriCloud