Commit 814d79771f67aa66e73d886bd6aaa553892558a8

Authored by ths
1 parent 5e0ccb18

linux-user fchmodat() syscall, by Thayne Harbaugh.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3226 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 139  
140 140  
141 141 #define __NR_sys_uname __NR_uname
  142 +#define __NR_sys_fchmodat __NR_fchmodat
142 143 #define __NR_sys_fchownat __NR_fchownat
143 144 #define __NR_sys_getcwd1 __NR_getcwd
144 145 #define __NR_sys_getdents __NR_getdents
... ... @@ -168,6 +169,10 @@ static int gettid(void) {
168 169 }
169 170 #endif
170 171 _syscall1(int,sys_uname,struct new_utsname *,buf)
  172 +#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
  173 +_syscall4(int,sys_fchmodat,int,dirfd,const char *,pathname,
  174 + mode_t,mode,int,flags)
  175 +#endif
171 176 #if defined(TARGET_NR_fchownat) && defined(__NR_fchownat)
172 177 _syscall5(int,sys_fchownat,int,dirfd,const char *,pathname,
173 178 uid_t,owner,gid_t,group,int,flags)
... ... @@ -3533,6 +3538,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
3533 3538 case TARGET_NR_fchmod:
3534 3539 ret = get_errno(fchmod(arg1, arg2));
3535 3540 break;
  3541 +#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
  3542 + case TARGET_NR_fchmodat:
  3543 + if (!arg2) {
  3544 + ret = -EFAULT;
  3545 + goto fail;
  3546 + }
  3547 + p = lock_user_string(arg2);
  3548 + if (!access_ok(VERIFY_READ, p, 1))
  3549 + ret = -EFAULT;
  3550 + else
  3551 + ret = get_errno(sys_fchmodat(arg1, p, arg3, arg4));
  3552 + if (p)
  3553 + unlock_user(p, arg2, 0);
  3554 + break;
  3555 +#endif
3536 3556 case TARGET_NR_getpriority:
3537 3557 ret = get_errno(getpriority(arg1, arg2));
3538 3558 break;
... ...