On Mon, 2007-09-24 at 13:45 -0600, Thayne Harbaugh wrote: > On Sun, 2007-09-23 at 12:58 -0400, Stuart Anderson wrote: > > On Sun, 23 Sep 2007, Thiemo Seufer wrote: > > > > > Thayne Harbaugh wrote: > > >> This patch adds the utimensat syscall to linux-user > > Oops! > > > > Doesn't build: > > > > > > gcc-3.4 -g -Wl,-T,/home/ths/qemu/qemu-work/ppc.ld -o qemu-arm main.o > > > syscall.o mmap.o signal.o path.o osdep.o thunk.o elfload.o linuxload.o > > > flatload.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o nwfpe/fpa11_cpdt.o > > > nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o > > > nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o libqemu.a gdbstub.o > > > -lm -lrt > > > syscall.o: In function `do_syscall': > > > /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference > > > to `copy_from_user_timespec' > > > /home/ths/qemu/qemu-work/linux-user/syscall.c:4665: undefined reference > > > to `copy_from_user_timespec' > > > > It's looking for something that is in the EFAULT patch. > > Yeah, I guess I had the EFAULT patch applied. I'll work up a patch for > utimensat() without the EFAULT patch.
Try this patch for utimensat() that doesn't depend on the EFAULT patch.
Index: qemu/linux-user/arm/syscall_nr.h =================================================================== --- qemu.orig/linux-user/arm/syscall_nr.h 2007-09-24 15:22:35.000000000 -0600 +++ qemu/linux-user/arm/syscall_nr.h 2007-09-24 15:22:58.000000000 -0600 @@ -325,3 +325,4 @@ #define TARGET_NR_mbind 319 #define TARGET_NR_get_mempolicy 320 #define TARGET_NR_set_mempolicy 321 +#define TARGET_NR_utimensat 348 Index: qemu/linux-user/i386/syscall_nr.h =================================================================== --- qemu.orig/linux-user/i386/syscall_nr.h 2007-09-24 15:22:42.000000000 -0600 +++ qemu/linux-user/i386/syscall_nr.h 2007-09-24 15:22:58.000000000 -0600 @@ -275,3 +275,5 @@ #define TARGET_NR_utimes 271 #define TARGET_NR_set_robust_list 311 + +#define TARGET_NR_utimensat 320 Index: qemu/linux-user/syscall.c =================================================================== --- qemu.orig/linux-user/syscall.c 2007-09-24 15:22:50.000000000 -0600 +++ qemu/linux-user/syscall.c 2007-09-24 15:41:51.000000000 -0600 @@ -146,6 +146,7 @@ #define __NR_sys_syslog __NR_syslog #define __NR_sys_tgkill __NR_tgkill #define __NR_sys_tkill __NR_tkill +#define __NR_sys_utimensat __NR_utimensat #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__) #define __NR__llseek __NR_lseek @@ -180,6 +181,10 @@ #if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address) _syscall1(int,set_tid_address,int *,tidptr) #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); @@ -4653,6 +4658,27 @@ 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);