aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-24 09:26:10 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-24 09:26:10 +0000
commit5e0ccb18da28cc9fdac725ef41a7c174125b56ac (patch)
tree62b1616180a05329e925646f2754802367685d59 /linux-user
parentf0b6243d5d7c18efbfcc7e477ffb9b8f523e2fef (diff)
linux-user readlinkat() syscall, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3225 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c7e5edf01e..639191f8aa 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -147,6 +147,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
#define __NR_sys_mkdirat __NR_mkdirat
#define __NR_sys_mknodat __NR_mknodat
#define __NR_sys_openat __NR_openat
+#define __NR_sys_readlinkat __NR_readlinkat
#define __NR_sys_renameat __NR_renameat
#define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
#define __NR_sys_symlinkat __NR_symlinkat
@@ -192,6 +193,10 @@ _syscall4(int,sys_mknodat,int,dirfd,const char *,pathname,
#if defined(TARGET_NR_openat) && defined(__NR_openat)
_syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
#endif
+#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat)
+_syscall4(int,sys_readlinkat,int,dirfd,const char *,pathname,
+ char *,buf,size_t,bufsize)
+#endif
#if defined(TARGET_NR_renameat) && defined(__NR_renameat)
_syscall4(int,sys_renameat,int,olddirfd,const char *,oldpath,
int,newdirfd,const char *,newpath)
@@ -3402,6 +3407,28 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
unlock_user(p, arg1, 0);
}
break;
+#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat)
+ case TARGET_NR_readlinkat:
+ if (!arg2 || !arg3) {
+ ret = -EFAULT;
+ goto fail;
+ }
+ {
+ void *p2 = NULL;
+ p = lock_user_string(arg2);
+ p2 = lock_user(arg3, arg4, 0);
+ if (!access_ok(VERIFY_READ, p, 1)
+ || !access_ok(VERIFY_READ, p2, 1))
+ ret = -EFAULT;
+ else
+ ret = get_errno(sys_readlinkat(arg1, path(p), p2, arg4));
+ if (p2)
+ unlock_user(p2, arg3, ret);
+ if (p)
+ unlock_user(p, arg2, 0);
+ }
+ break;
+#endif
#ifdef TARGET_NR_uselib
case TARGET_NR_uselib:
goto unimplemented;