From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXzKN-0000GU-UF for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:10:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXzKM-0000GE-7P for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:10:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXzKM-0000GB-0y for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:10: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 1IXzKL-0001Xj-N6 for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:10:49 -0400 From: Thayne Harbaugh In-Reply-To: <1190207013.9564.109.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> Content-Type: multipart/mixed; boundary="=-bG8a2CoPKmyDJGLVzQOQ" Date: Wed, 19 Sep 2007 07:04:19 -0600 Message-Id: <1190207059.9564.111.camel@phantasm.home.enterpriseandprosperity.com> Mime-Version: 1.0 Subject: [Qemu-devel] Re: [PATCH] linux-user readlinkat() 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 --=-bG8a2CoPKmyDJGLVzQOQ Content-Type: text/plain Content-Transfer-Encoding: 7bit This patch adds the readlinkat syscall to linux-user. --=-bG8a2CoPKmyDJGLVzQOQ Content-Disposition: attachment; filename=32_readlinkat.patch Content-Type: text/x-patch; name=32_readlinkat.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: qemu/linux-user/syscall.c =================================================================== --- qemu.orig/linux-user/syscall.c 2007-09-19 06:26:51.000000000 -0600 +++ qemu/linux-user/syscall.c 2007-09-19 06:27:29.000000000 -0600 @@ -160,6 +160,7 @@ #define __NR_sys_mkdirat __NR_mkdirat #define __NR_sys_mknodat __NR_mknodat #define __NR_sys_openat __NR_openat +#define __NR_sys_readlinkat __NR_readlinkat #define __NR_sys_renameat __NR_renameat #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo #define __NR_sys_symlinkat __NR_symlinkat @@ -210,6 +211,10 @@ #if defined(TARGET_NR_openat) && defined(__NR_openat) _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode) #endif +#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat) +_syscall4(int,sys_readlinkat,int,dirfd,const char *,pathname, + char *,buf,size_t,bufsize) +#endif #if defined(TARGET_NR_renameat) && defined(__NR_renameat) _syscall4(int,sys_renameat,int,olddirfd,const char *,oldpath, int,newdirfd,const char *,newpath) @@ -3584,6 +3589,28 @@ unlock_user(p, arg1, 0); } break; +#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat) + case TARGET_NR_readlinkat: + if (!arg2 || !arg3) { + ret = -EFAULT; + goto fail; + } + { + void *p2 = NULL; + p = lock_user_string(arg2); + p2 = lock_user(arg3, arg4, 0); + if (!access_ok(VERIFY_READ, p, 1) + || !access_ok(VERIFY_READ, p2, 1)) + ret = -EFAULT; + else + ret = get_errno(sys_readlinkat(arg1, path(p), p2, arg4)); + if (p2) + unlock_user(p2, arg3, ret); + if (p) + unlock_user(p, arg2, 0); + } + break; +#endif #ifdef TARGET_NR_uselib case TARGET_NR_uselib: goto unimplemented; Index: qemu/linux-user/arm/syscall_nr.h =================================================================== --- qemu.orig/linux-user/arm/syscall_nr.h 2007-09-19 06:26:21.000000000 -0600 +++ qemu/linux-user/arm/syscall_nr.h 2007-09-19 06:26:57.000000000 -0600 @@ -334,4 +334,5 @@ #define TARGET_NR_renameat 329 #define TARGET_NR_linkat 330 #define TARGET_NR_symlinkat 331 +#define TARGET_NR_readlinkat 332 #define TARGET_NR_utimensat 348 --=-bG8a2CoPKmyDJGLVzQOQ--