Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ia25e-0001SD-Fo for qemu-devel@nongnu.org; Tue, 25 Sep 2007 00:32:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ia25c-0001Rp-Iu for qemu-devel@nongnu.org; Tue, 25 Sep 2007 00:32:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ia25c-0001Rl-C7 for qemu-devel@nongnu.org; Tue, 25 Sep 2007 00:32:04 -0400 Received: from owa.c2.net ([207.235.78.2] helo=email.c2.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ia25c-0004D8-1e for qemu-devel@nongnu.org; Tue, 25 Sep 2007 00:32:04 -0400 Subject: Re: [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall From: Thayne Harbaugh In-Reply-To: <1190663112.8288.14.camel@phantasm.home.enterpriseandprosperity.com> References: <1190205992.9564.88.camel@phantasm.home.enterpriseandprosperity.com> <1190206302.9564.91.camel@phantasm.home.enterpriseandprosperity.com> <20070923154205.GB20994@networkno.de> <1190663112.8288.14.camel@phantasm.home.enterpriseandprosperity.com> Content-Type: multipart/mixed; boundary="=-rtVQXr7sx5c8H1wbxRze" Date: Mon, 24 Sep 2007 22:25:03 -0600 Message-Id: <1190694303.8288.34.camel@phantasm.home.enterpriseandprosperity.com> Mime-Version: 1.0 Reply-To: thayne@c2.net, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-rtVQXr7sx5c8H1wbxRze Content-Type: text/plain Content-Transfer-Encoding: 7bit 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. --=-rtVQXr7sx5c8H1wbxRze Content-Disposition: attachment; filename=22_utimensat.2.patch Content-Type: text/x-patch; name=22_utimensat.2.patch; charset=utf-8 Content-Transfer-Encoding: 7bit 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); --=-rtVQXr7sx5c8H1wbxRze--