summaryrefslogtreecommitdiffstats
path: root/sys/kern
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 /sys/kern
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 'sys/kern')
-rw-r--r--sys/kern/syscalls.master1
-rw-r--r--sys/kern/vfs_syscalls.c27
2 files changed, 24 insertions, 4 deletions
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 940f13d..4e2e99c 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -910,5 +910,6 @@
struct msqid_ds *buf); }
512 AUE_SHMCTL NOSTD { int shmctl(int shmid, int cmd, \
struct shmid_ds *buf); }
+513 AUE_LPATHCONF STD { int lpathconf(char *path, int name); }
; Please copy any additions and changes to the following compatability tables:
; sys/compat/freebsd32/syscalls.master
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7252c47..28d95e2e 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2506,17 +2506,36 @@ pathconf(td, uap)
} */ *uap;
{
- return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name));
+ return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, FOLLOW));
+}
+
+#ifndef _SYS_SYSPROTO_H_
+struct lpathconf_args {
+ char *path;
+ int name;
+};
+#endif
+int
+lpathconf(td, uap)
+ struct thread *td;
+ register struct lpathconf_args /* {
+ char *path;
+ int name;
+ } */ *uap;
+{
+
+ return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, NOFOLLOW));
}
int
-kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name)
+kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name,
+ u_long flags)
{
struct nameidata nd;
int error, vfslocked;
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE |
- AUDITVNODE1, pathseg, path, td);
+ NDINIT(&nd, LOOKUP, LOCKSHARED | LOCKLEAF | MPSAFE | AUDITVNODE1 |
+ flags, pathseg, path, td);
if ((error = namei(&nd)) != 0)
return (error);
vfslocked = NDHASGIANT(&nd);
OpenPOWER on IntegriCloud