From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXzRA-0002hd-3v for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:17:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXzR8-0002hJ-HI for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:17:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXzR8-0002hA-02 for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:17:50 -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 1IXzR7-0002i1-Oq for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:17:49 -0400 From: Thayne Harbaugh In-Reply-To: <1190207348.9564.119.camel@phantasm.home.enterpriseandprosperity.com> References: <1190205992.9564.88.camel@phantasm.home.enterpriseandprosperity.com> <1190206302.9564.91.camel@phantasm.home.enterpriseandprosperity.com> <1190206395.9564.94.camel@phantasm.home.enterpriseandprosperity.com> <1190206457.9564.95.camel@phantasm.home.enterpriseandprosperity.com> <1190206659.9564.97.camel@phantasm.home.enterpriseandprosperity.com> <1190206714.9564.99.camel@phantasm.home.enterpriseandprosperity.com> <1190206770.9564.101.camel@phantasm.home.enterpriseandprosperity.com> <1190206856.9564.104.camel@phantasm.home.enterpriseandprosperity.com> <1190206906.9564.105.camel@phantasm.home.enterpriseandprosperity.com> <1190206961.9564.107.camel@phantasm.home.enterpriseandprosperity.com> <1190207013.9564.109.camel@phantasm.home.enterpriseandprosperity.com> <1190207059.9564.111.camel@phantasm.home.enterpriseandprosperity.com> <1190207107.9564.113.camel@phantasm.home.enterpriseandprosperity.com> <1190207177.9564.115.camel@phantasm.home.enterpriseandprosperity.com> <1190207348.9564.119.camel@phantasm.home.enterpriseandprosperity.com> Content-Type: multipart/mixed; boundary="=-OPtDbLPRyX533c1JLS3x" Date: Wed, 19 Sep 2007 07:11:15 -0600 Message-Id: <1190207475.9564.122.camel@phantasm.home.enterpriseandprosperity.com> Mime-Version: 1.0 Subject: [Qemu-devel] Re: [PATCH] linux-user fstatat syscall 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 --=-OPtDbLPRyX533c1JLS3x Content-Type: text/plain Content-Transfer-Encoding: 7bit This patch adds the fstatat syscall to linux-user. To depends on the previous stat64_put_user patch. --=-OPtDbLPRyX533c1JLS3x Content-Disposition: attachment; filename=35_fstatat64.patch Content-Type: text/x-patch; name=35_fstatat64.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: qemu/linux-user/syscall.c =================================================================== --- qemu.orig/linux-user/syscall.c 2007-09-19 06:28:34.000000000 -0600 +++ qemu/linux-user/syscall.c 2007-09-19 06:31:35.000000000 -0600 @@ -149,11 +149,26 @@ return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5, arg6); \ } +#if defined(__NR_fstatat64) +#define HOST_NR_FSTATAT __NR_fstatat64 +typedef struct stat64 host_statbuf_t; +#elif defined(__NR_newfstatat) +#define HOST_NR_FSTATAT __NR_newfstatat +typedef struct stat host_statbuf_t; +#endif +#if defined(TARGET_NR_fstatat64) +#define TARGET_NR_FSTATAT (TARGET_NR_fstatat64) +typedef struct target_stat64 target_statbuf_t; +#elif defined(TARGET_NR_newfstatat) +#define TARGET_NR_FSTATAT (TARGET_NR_newfstatat) +typedef struct target_stat target_statbuf_t; +#endif #define __NR_sys_uname __NR_uname #define __NR_sys_faccessat __NR_faccessat #define __NR_sys_fchmodat __NR_fchmodat #define __NR_sys_fchownat __NR_fchownat +#define __NR_sys_fstatat HOST_NR_FSTATAT #define __NR_sys_futimesat __NR_futimesat #define __NR_sys_getcwd1 __NR_getcwd #define __NR_sys_getdents __NR_getdents @@ -170,6 +185,9 @@ #define __NR_sys_tgkill __NR_tgkill #define __NR_sys_tkill __NR_tkill #define __NR_sys_unlinkat __NR_unlinkat +#if !defined(__NR_utimensat) && defined(__x86_64__) +#define __NR_utimensat 280 +#endif #define __NR_sys_utimensat __NR_utimensat #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__) @@ -199,6 +217,10 @@ _syscall3(int,sys_futimesat,int,dirfd,const char *,pathname, const struct timeval *,times) #endif +#if defined(TARGET_NR_FSTATAT) && (HOST_NR_FSTATAT) +_syscall4(int,sys_fstatat,int,dirfd,const char *,pathname, + host_statbuf_t *,buf,int,flags) +#endif _syscall2(int,sys_getcwd1,char *,buf,size_t,size) _syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count); #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64) @@ -533,7 +555,7 @@ : copy_to_user_statbuf64((tsb),(hsb))) #else #define copy_to_user_statbuf64_wrapper(tsb,hsb) \ - copy_to_user_eabi_statbuf64((tsb),(hsb)) + copy_to_user_statbuf64((tsb),(hsb)) #endif #ifdef TARGET_ARM @@ -4731,6 +4753,28 @@ unlock_user(p, arg2, 0); break; #endif +#if defined(TARGET_NR_FSTATAT) && defined(HOST_NR_FSTATAT) + case TARGET_NR_FSTATAT: + if (!arg2) { + ret = -EFAULT; + goto fail; + } + { + host_statbuf_t statbuf; + p = lock_user_string(arg2); + if (!access_ok(VERIFY_READ, p, 1)) + ret = -EFAULT; + else { + ret = get_errno(sys_fstatat(arg1, path(p), &statbuf, arg4)); + if (!is_error(ret) + && copy_to_user_statbuf64_wrapper((struct target_stat64 *)arg3, &statbuf)) + ret = -EFAULT; + } + if (p) + unlock_user(p, arg2, 0); + } + break; +#endif #ifdef TARGET_NR_setresuid case TARGET_NR_setresuid: ret = get_errno(setresuid(low2highuid(arg1), Index: qemu/linux-user/arm/syscall_nr.h =================================================================== --- qemu.orig/linux-user/arm/syscall_nr.h 2007-09-19 06:28:08.000000000 -0600 +++ qemu/linux-user/arm/syscall_nr.h 2007-09-19 06:29:54.000000000 -0600 @@ -330,6 +330,7 @@ #define TARGET_NR_mknodat 324 #define TARGET_NR_fchownat 325 #define TARGET_NR_futimesat 326 +#define TARGET_NR_fstatat64 327 #define TARGET_NR_unlinkat 328 #define TARGET_NR_renameat 329 #define TARGET_NR_linkat 330 --=-OPtDbLPRyX533c1JLS3x--