Commit 92a34c10b595ae01ff55c385b9867363ac91e0eb
1 parent
814d7977
linux-user faccessat() syscall, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3227 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
19 additions
and
0 deletions
linux-user/syscall.c
... | ... | @@ -139,6 +139,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ |
139 | 139 | |
140 | 140 | |
141 | 141 | #define __NR_sys_uname __NR_uname |
142 | +#define __NR_sys_faccessat __NR_faccessat | |
142 | 143 | #define __NR_sys_fchmodat __NR_fchmodat |
143 | 144 | #define __NR_sys_fchownat __NR_fchownat |
144 | 145 | #define __NR_sys_getcwd1 __NR_getcwd |
... | ... | @@ -169,6 +170,9 @@ static int gettid(void) { |
169 | 170 | } |
170 | 171 | #endif |
171 | 172 | _syscall1(int,sys_uname,struct new_utsname *,buf) |
173 | +#if defined(TARGET_NR_faccessat) && defined(__NR_faccessat) | |
174 | +_syscall4(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode,int,flags) | |
175 | +#endif | |
172 | 176 | #if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat) |
173 | 177 | _syscall4(int,sys_fchmodat,int,dirfd,const char *,pathname, |
174 | 178 | mode_t,mode,int,flags) |
... | ... | @@ -2851,6 +2855,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2851 | 2855 | ret = get_errno(access(p, arg2)); |
2852 | 2856 | unlock_user(p, arg1, 0); |
2853 | 2857 | break; |
2858 | +#if defined(TARGET_NR_faccessat) && defined(__NR_faccessat) | |
2859 | + case TARGET_NR_faccessat: | |
2860 | + if (!arg2) { | |
2861 | + ret = -EFAULT; | |
2862 | + goto fail; | |
2863 | + } | |
2864 | + p = lock_user_string(arg2); | |
2865 | + if (!access_ok(VERIFY_READ, p, 1)) | |
2866 | + ret = -EFAULT; | |
2867 | + else | |
2868 | + ret = get_errno(sys_faccessat(arg1, p, arg3, arg4)); | |
2869 | + if (p) | |
2870 | + unlock_user(p, arg2, 0); | |
2871 | + break; | |
2872 | +#endif | |
2854 | 2873 | #ifdef TARGET_NR_nice /* not on alpha */ |
2855 | 2874 | case TARGET_NR_nice: |
2856 | 2875 | ret = get_errno(nice(arg1)); | ... | ... |