Commit 824248322670885c95213c81a20551ab2434228f
1 parent
8dd77cca
linux-user openat() syscall, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3217 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
22 additions
and
0 deletions
linux-user/syscall.c
... | ... | @@ -142,6 +142,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ |
142 | 142 | #define __NR_sys_getcwd1 __NR_getcwd |
143 | 143 | #define __NR_sys_getdents __NR_getdents |
144 | 144 | #define __NR_sys_getdents64 __NR_getdents64 |
145 | +#define __NR_sys_openat __NR_openat | |
145 | 146 | #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo |
146 | 147 | #define __NR_sys_syslog __NR_syslog |
147 | 148 | #define __NR_sys_tgkill __NR_tgkill |
... | ... | @@ -166,6 +167,9 @@ _syscall3(int, sys_getdents64, uint, fd, struct dirent64 *, dirp, uint, count); |
166 | 167 | #endif |
167 | 168 | _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, |
168 | 169 | loff_t *, res, uint, wh); |
170 | +#if defined(TARGET_NR_openat) && defined(__NR_openat) | |
171 | +_syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode) | |
172 | +#endif | |
169 | 173 | _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo) |
170 | 174 | _syscall3(int,sys_syslog,int,type,char*,bufp,int,len) |
171 | 175 | #if defined(TARGET_NR_tgkill) && defined(__NR_tgkill) |
... | ... | @@ -2500,6 +2504,24 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2500 | 2504 | arg3)); |
2501 | 2505 | unlock_user(p, arg1, 0); |
2502 | 2506 | break; |
2507 | +#if defined(TARGET_NR_openat) && defined(__NR_openat) | |
2508 | + case TARGET_NR_openat: | |
2509 | + if (!arg2) { | |
2510 | + ret = -EFAULT; | |
2511 | + goto fail; | |
2512 | + } | |
2513 | + p = lock_user_string(arg2); | |
2514 | + if (!access_ok(VERIFY_READ, p, 1)) | |
2515 | + ret = -EFAULT; | |
2516 | + else | |
2517 | + ret = get_errno(sys_openat(arg1, | |
2518 | + path(p), | |
2519 | + target_to_host_bitmask(arg3, fcntl_flags_tbl), | |
2520 | + arg4)); | |
2521 | + if (p) | |
2522 | + unlock_user(p, arg2, 0); | |
2523 | + break; | |
2524 | +#endif | |
2503 | 2525 | case TARGET_NR_close: |
2504 | 2526 | ret = get_errno(close(arg1)); |
2505 | 2527 | break; | ... | ... |