From 9007f0ef73771c2dd30e3092d6c06c4bc5ebfe0d Mon Sep 17 00:00:00 2001 From: ths Date: Tue, 25 Sep 2007 17:50:37 +0000 Subject: [PATCH] linux-user utimensat() syscall, by Thayne Harbaugh. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3240 c046a42c-6fe2-441c-8c8c-71466251a162 --- linux-user/syscall.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 645780e852..bd66f905ed 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -157,6 +157,7 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ #define __NR_sys_tgkill __NR_tgkill #define __NR_sys_tkill __NR_tkill #define __NR_sys_unlinkat __NR_unlinkat +#define __NR_sys_utimensat __NR_utimensat #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__) #define __NR__llseek __NR_lseek @@ -231,6 +232,10 @@ _syscall1(int,set_tid_address,int *,tidptr) #if defined(TARGET_NR_unlinkat) && defined(__NR_unlinkat) _syscall3(int,sys_unlinkat,int,dirfd,const char *,pathname,int,flags) #endif +#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat) +_syscall4(int,sys_utimensat,int,dirfd,const char *,pathname, + const struct timespec *,tsp,int,flags) +#endif extern int personality(int); extern int flock(int, int); @@ -4900,6 +4905,27 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, goto unimplemented_nowarn; #endif +#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat) + case TARGET_NR_utimensat: + { + struct timespec ts[2]; + target_to_host_timespec(ts, arg3); + target_to_host_timespec(ts+1, arg3+sizeof(struct target_timespec)); + if (!arg2) + ret = get_errno(sys_utimensat(arg1, NULL, ts, arg4)); + else { + p = lock_user_string(arg2); + if (!access_ok(VERIFY_READ, p, 1)) + ret = -EFAULT; + else + ret = get_errno(sys_utimensat(arg1, path(p), ts, arg4)); + if (p) + unlock_user(p, arg2, 0); + } + } + break; +#endif + default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num);