summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-24 09:27:49 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-24 09:27:49 +0000
commit92a34c10b595ae01ff55c385b9867363ac91e0eb (patch)
tree161e7385ef8c823afeece4f5233bcffe05d261dd
parent814d79771f67aa66e73d886bd6aaa553892558a8 (diff)
downloadqemu-92a34c10b595ae01ff55c385b9867363ac91e0eb.tar.gz
linux-user faccessat() syscall, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3227 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--linux-user/syscall.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 120b55b129..05f8596bc2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -139,6 +139,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
#define __NR_sys_uname __NR_uname
+#define __NR_sys_faccessat __NR_faccessat
#define __NR_sys_fchmodat __NR_fchmodat
#define __NR_sys_fchownat __NR_fchownat
#define __NR_sys_getcwd1 __NR_getcwd
@@ -169,6 +170,9 @@ static int gettid(void) {
}
#endif
_syscall1(int,sys_uname,struct new_utsname *,buf)
+#if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
+_syscall4(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode,int,flags)
+#endif
#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
_syscall4(int,sys_fchmodat,int,dirfd,const char *,pathname,
mode_t,mode,int,flags)
@@ -2851,6 +2855,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
ret = get_errno(access(p, arg2));
unlock_user(p, arg1, 0);
break;
+#if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
+ case TARGET_NR_faccessat:
+ if (!arg2) {
+ ret = -EFAULT;
+ goto fail;
+ }
+ p = lock_user_string(arg2);
+ if (!access_ok(VERIFY_READ, p, 1))
+ ret = -EFAULT;
+ else
+ ret = get_errno(sys_faccessat(arg1, p, arg3, arg4));
+ if (p)
+ unlock_user(p, arg2, 0);
+ break;
+#endif
#ifdef TARGET_NR_nice /* not on alpha */
case TARGET_NR_nice:
ret = get_errno(nice(arg1));