From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXzIr-0008HA-4K for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:09:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXzIq-0008Go-Fr for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:09:16 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXzIq-0008Gj-5d for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:09:16 -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 1IXzIp-0001Jc-OZ for qemu-devel@nongnu.org; Wed, 19 Sep 2007 09:09:15 -0400 From: Thayne Harbaugh In-Reply-To: <1190206906.9564.105.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> Content-Type: multipart/mixed; boundary="=-BzbBOLcyIr+XS2XZCvUT" Date: Wed, 19 Sep 2007 07:02:41 -0600 Message-Id: <1190206961.9564.107.camel@phantasm.home.enterpriseandprosperity.com> Mime-Version: 1.0 Subject: [Qemu-devel] Re: [PATCH] linux-user linkat() 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 --=-BzbBOLcyIr+XS2XZCvUT Content-Type: text/plain Content-Transfer-Encoding: 7bit This patch adds the linkat syscall to linux-user. --=-BzbBOLcyIr+XS2XZCvUT Content-Disposition: attachment; filename=30_linkat.patch Content-Type: text/x-patch; name=30_linkat.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: qemu/linux-user/syscall.c =================================================================== --- qemu.orig/linux-user/syscall.c 2007-09-19 06:24:47.000000000 -0600 +++ qemu/linux-user/syscall.c 2007-09-19 06:25:51.000000000 -0600 @@ -156,6 +156,7 @@ #define __NR_sys_getcwd1 __NR_getcwd #define __NR_sys_getdents __NR_getdents #define __NR_sys_getdents64 __NR_getdents64 +#define __NR_sys_linkat __NR_linkat #define __NR_sys_mkdirat __NR_mkdirat #define __NR_sys_mknodat __NR_mknodat #define __NR_sys_openat __NR_openat @@ -194,6 +195,10 @@ #endif _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh); +#if defined(TARGET_NR_linkat) && defined(__NR_linkat) +_syscall5(int,sys_linkat,int,olddirfd,const char *,oldpath, + int,newdirfd,const char *,newpath,int,flags) +#endif #if defined(TARGET_NR_mkdirat) && defined(__NR_mkdirat) _syscall3(int,sys_mkdirat,int,dirfd,const char *,pathname,mode_t,mode) #endif @@ -2766,6 +2771,28 @@ unlock_user(p, arg1, 0); } break; +#if defined(TARGET_NR_linkat) && defined(__NR_linkat) + case TARGET_NR_linkat: + if (!arg2 || !arg4) { + ret = -EFAULT; + goto fail; + } + { + void * p2 = NULL; + p = lock_user_string(arg2); + p2 = lock_user_string(arg4); + if (!access_ok(VERIFY_READ, p, 1) + || !access_ok(VERIFY_READ, p2, 1)) + ret = -EFAULT; + else + ret = get_errno(sys_linkat(arg1, p, arg3, p2, arg5)); + if (p2) + unlock_user(p, arg2, 0); + if (p) + unlock_user(p2, arg4, 0); + } + break; +#endif case TARGET_NR_unlink: p = lock_user_string(arg1); ret = get_errno(unlink(p)); Index: qemu/linux-user/arm/syscall_nr.h =================================================================== --- qemu.orig/linux-user/arm/syscall_nr.h 2007-09-19 06:24:10.000000000 -0600 +++ qemu/linux-user/arm/syscall_nr.h 2007-09-19 06:25:08.000000000 -0600 @@ -332,4 +332,5 @@ #define TARGET_NR_futimesat 326 #define TARGET_NR_unlinkat 328 #define TARGET_NR_renameat 329 +#define TARGET_NR_linkat 330 #define TARGET_NR_utimensat 348 --=-BzbBOLcyIr+XS2XZCvUT--