Commit ccfa72b7dae809973f67dfd3d50795a311ecd7b7
1 parent
75ac37a0
linux-user fchownat() syscall, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3220 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
20 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,6 +139,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ | ||
139 | 139 | ||
140 | 140 | ||
141 | #define __NR_sys_uname __NR_uname | 141 | #define __NR_sys_uname __NR_uname |
142 | +#define __NR_sys_fchownat __NR_fchownat | ||
142 | #define __NR_sys_getcwd1 __NR_getcwd | 143 | #define __NR_sys_getcwd1 __NR_getcwd |
143 | #define __NR_sys_getdents __NR_getdents | 144 | #define __NR_sys_getdents __NR_getdents |
144 | #define __NR_sys_getdents64 __NR_getdents64 | 145 | #define __NR_sys_getdents64 __NR_getdents64 |
@@ -162,6 +163,10 @@ static int gettid(void) { | @@ -162,6 +163,10 @@ static int gettid(void) { | ||
162 | } | 163 | } |
163 | #endif | 164 | #endif |
164 | _syscall1(int,sys_uname,struct new_utsname *,buf) | 165 | _syscall1(int,sys_uname,struct new_utsname *,buf) |
166 | +#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) | ||
167 | +_syscall5(int,sys_fchownat,int,dirfd,const char *,pathname, | ||
168 | + uid_t,owner,gid_t,group,int,flags) | ||
169 | +#endif | ||
165 | _syscall2(int,sys_getcwd1,char *,buf,size_t,size) | 170 | _syscall2(int,sys_getcwd1,char *,buf,size_t,size) |
166 | _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count); | 171 | _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count); |
167 | #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64) | 172 | #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64) |
@@ -4293,6 +4298,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | @@ -4293,6 +4298,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, | ||
4293 | case TARGET_NR_fchown: | 4298 | case TARGET_NR_fchown: |
4294 | ret = get_errno(fchown(arg1, low2highuid(arg2), low2highgid(arg3))); | 4299 | ret = get_errno(fchown(arg1, low2highuid(arg2), low2highgid(arg3))); |
4295 | break; | 4300 | break; |
4301 | +#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) | ||
4302 | + case TARGET_NR_fchownat: | ||
4303 | + if (!arg2) { | ||
4304 | + ret = -EFAULT; | ||
4305 | + goto fail; | ||
4306 | + } | ||
4307 | + p = lock_user_string(arg2); | ||
4308 | + if (!access_ok(VERIFY_READ, p, 1)) | ||
4309 | + ret = -EFAULT; | ||
4310 | + else | ||
4311 | + ret = get_errno(sys_fchownat(arg1, p, low2highuid(arg3), low2highgid(arg4), arg5)); | ||
4312 | + if (p) | ||
4313 | + unlock_user(p, arg2, 0); | ||
4314 | + break; | ||
4315 | +#endif | ||
4296 | #ifdef TARGET_NR_setresuid | 4316 | #ifdef TARGET_NR_setresuid |
4297 | case TARGET_NR_setresuid: | 4317 | case TARGET_NR_setresuid: |
4298 | ret = get_errno(setresuid(low2highuid(arg1), | 4318 | ret = get_errno(setresuid(low2highuid(arg1), |