Commit 4472ad0dbd3a0ee26915f259c92e5dddecef060a

Authored by ths
1 parent 82424832

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


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3218 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 19 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_mkdirat __NR_mkdirat
145 146 #define __NR_sys_openat __NR_openat
146 147 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
147 148 #define __NR_sys_syslog __NR_syslog
... ... @@ -167,6 +168,9 @@ _syscall3(int, sys_getdents64, uint, fd, struct dirent64 *, dirp, uint, count);
167 168 #endif
168 169 _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
169 170 loff_t *, res, uint, wh);
  171 +#if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat)
  172 +_syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode)
  173 +#endif
170 174 #if defined(TARGET_NR_openat) && defined(__NR_openat)
171 175 _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
172 176 #endif
... ... @@ -2787,6 +2791,21 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
2787 2791 ret = get_errno(mkdir(p, arg2));
2788 2792 unlock_user(p, arg1, 0);
2789 2793 break;
  2794 +#if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat)
  2795 + case TARGET_NR_mkdirat:
  2796 + if (!arg2) {
  2797 + ret = -EFAULT;
  2798 + goto fail;
  2799 + }
  2800 + p = lock_user_string(arg2);
  2801 + if (!access_ok(VERIFY_READ, p, 1))
  2802 + ret = -EFAULT;
  2803 + else
  2804 + ret = get_errno(sys_mkdirat(arg1, p, arg3));
  2805 + if (p)
  2806 + unlock_user(p, arg2, 0);
  2807 + break;
  2808 +#endif
2790 2809 case TARGET_NR_rmdir:
2791 2810 p = lock_user_string(arg1);
2792 2811 ret = get_errno(rmdir(p));
... ...