aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-02-24 16:04:21 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-24 17:31:39 -0500
commitc04030e16dbea2f7581f82cc6688695927f6ac5b (patch)
tree7ff5cd2494a133f1bf571f7af02e656bb01d124f
parentee713059d4922e4ee17700496d9eb3b95b1ab836 (diff)
[PATCH] flags parameter for linkat
I'm currently at the POSIX meeting and one thing covered was the incompatibility of Linux's link() with the POSIX definition. The name. Linux does not follow symlinks, POSIX requires it does. Even if somebody thinks this is a good default behavior we cannot change this because it would break the ABI. But the fact remains that some application might want this behavior. We have one chance to help implementing this without breaking the behavior. For this we could use the new linkat interface which would need a new flags parameter. If the new parameter is AT_SYMLINK_FOLLOW the new behavior could be invoked. I do not want to introduce such a patch now. But we could add the parameter now, just don't use it. The patch below would do this. Can we get this late patch applied before the release more or less fixes the syscall API? Signed-off-by: Ulrich Drepper <drepper@redhat.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/s390/kernel/compat_wrapper.S1
-rw-r--r--fs/namei.c8
-rw-r--r--include/linux/syscalls.h2
4 files changed, 9 insertions, 4 deletions
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d83e033dbc87..2f2dc54b2e26 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -626,7 +626,7 @@ einval: li v0, -EINVAL
626 sys sys_fstatat64 4 626 sys sys_fstatat64 4
627 sys sys_unlinkat 3 627 sys sys_unlinkat 3
628 sys sys_renameat 4 /* 4295 */ 628 sys sys_renameat 4 /* 4295 */
629 sys sys_linkat 4 629 sys sys_linkat 5
630 sys sys_symlinkat 3 630 sys sys_symlinkat 3
631 sys sys_readlinkat 4 631 sys sys_readlinkat 4
632 sys sys_fchmodat 3 632 sys sys_fchmodat 3
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 615964cca15f..50e80138e7ad 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1552,6 +1552,7 @@ sys_linkat_wrapper:
1552 llgtr %r3,%r3 # const char * 1552 llgtr %r3,%r3 # const char *
1553 lgfr %r4,%r4 # int 1553 lgfr %r4,%r4 # int
1554 llgtr %r5,%r5 # const char * 1554 llgtr %r5,%r5 # const char *
1555 lgfr %r6,%r6 # int
1555 jg sys_linkat 1556 jg sys_linkat
1556 1557
1557 .globl sys_symlinkat_wrapper 1558 .globl sys_symlinkat_wrapper
diff --git a/fs/namei.c b/fs/namei.c
index e28de846c591..557dcf395ca1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2224,13 +2224,17 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2224 * and other special files. --ADM 2224 * and other special files. --ADM
2225 */ 2225 */
2226asmlinkage long sys_linkat(int olddfd, const char __user *oldname, 2226asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2227 int newdfd, const char __user *newname) 2227 int newdfd, const char __user *newname,
2228 int flags)
2228{ 2229{
2229 struct dentry *new_dentry; 2230 struct dentry *new_dentry;
2230 struct nameidata nd, old_nd; 2231 struct nameidata nd, old_nd;
2231 int error; 2232 int error;
2232 char * to; 2233 char * to;
2233 2234
2235 if (flags != 0)
2236 return -EINVAL;
2237
2234 to = getname(newname); 2238 to = getname(newname);
2235 if (IS_ERR(to)) 2239 if (IS_ERR(to))
2236 return PTR_ERR(to); 2240 return PTR_ERR(to);
@@ -2263,7 +2267,7 @@ exit:
2263 2267
2264asmlinkage long sys_link(const char __user *oldname, const char __user *newname) 2268asmlinkage long sys_link(const char __user *oldname, const char __user *newname)
2265{ 2269{
2266 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname); 2270 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
2267} 2271}
2268 2272
2269/* 2273/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index d73501ba7e44..b9ea44ac0ddb 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -543,7 +543,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
543asmlinkage long sys_symlinkat(const char __user * oldname, 543asmlinkage long sys_symlinkat(const char __user * oldname,
544 int newdfd, const char __user * newname); 544 int newdfd, const char __user * newname);
545asmlinkage long sys_linkat(int olddfd, const char __user *oldname, 545asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
546 int newdfd, const char __user *newname); 546 int newdfd, const char __user *newname, int flags);
547asmlinkage long sys_renameat(int olddfd, const char __user * oldname, 547asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
548 int newdfd, const char __user * newname); 548 int newdfd, const char __user * newname);
549asmlinkage long sys_futimesat(int dfd, char __user *filename, 549asmlinkage long sys_futimesat(int dfd, char __user *filename,