Commit 9007f0ef73771c2dd30e3092d6c06c4bc5ebfe0d

Authored by ths
1 parent eb296a0a

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


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3240 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 26 additions and 0 deletions
linux-user/syscall.c
... ... @@ -157,6 +157,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
157 157 #define __NR_sys_tgkill __NR_tgkill
158 158 #define __NR_sys_tkill __NR_tkill
159 159 #define __NR_sys_unlinkat __NR_unlinkat
  160 +#define __NR_sys_utimensat __NR_utimensat
160 161  
161 162 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
162 163 #define __NR__llseek __NR_lseek
... ... @@ -231,6 +232,10 @@ _syscall1(int,set_tid_address,int *,tidptr)
231 232 #if defined(TARGET_NR_unlinkat) && defined(__NR_unlinkat)
232 233 _syscall3(int,sys_unlinkat,int,dirfd,const char *,pathname,int,flags)
233 234 #endif
  235 +#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
  236 +_syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
  237 + const struct timespec *,tsp,int,flags)
  238 +#endif
234 239  
235 240 extern int personality(int);
236 241 extern int flock(int, int);
... ... @@ -4900,6 +4905,27 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
4900 4905 goto unimplemented_nowarn;
4901 4906 #endif
4902 4907  
  4908 +#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
  4909 + case TARGET_NR_utimensat:
  4910 + {
  4911 + struct timespec ts[2];
  4912 + target_to_host_timespec(ts, arg3);
  4913 + target_to_host_timespec(ts+1, arg3+sizeof(struct target_timespec));
  4914 + if (!arg2)
  4915 + ret = get_errno(sys_utimensat(arg1, NULL, ts, arg4));
  4916 + else {
  4917 + p = lock_user_string(arg2);
  4918 + if (!access_ok(VERIFY_READ, p, 1))
  4919 + ret = -EFAULT;
  4920 + else
  4921 + ret = get_errno(sys_utimensat(arg1, path(p), ts, arg4));
  4922 + if (p)
  4923 + unlock_user(p, arg2, 0);
  4924 + }
  4925 + }
  4926 + break;
  4927 +#endif
  4928 +
4903 4929 default:
4904 4930 unimplemented:
4905 4931 gemu_log("qemu: Unsupported syscall: %d\n", num);
... ...