From patchwork Thu Jun 20 15:57:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 253022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F2E212C0089 for ; Fri, 21 Jun 2013 01:57:48 +1000 (EST) Received: from localhost ([::1]:35731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UphF4-0005PN-7K for incoming@patchwork.ozlabs.org; Thu, 20 Jun 2013 11:57:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UphEj-0005AO-Vu for qemu-devel@nongnu.org; Thu, 20 Jun 2013 11:57:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UphEh-00077Y-AX for qemu-devel@nongnu.org; Thu, 20 Jun 2013 11:57:25 -0400 Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:1d0::1]:58021 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UphEh-00077N-48 for qemu-devel@nongnu.org; Thu, 20 Jun 2013 11:57:23 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1UphEf-0006nb-52; Thu, 20 Jun 2013 16:57:21 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 20 Jun 2013 16:57:21 +0100 Message-Id: <1371743841-26110-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Riku Voipio , patches@linaro.org Subject: [Qemu-devel] [PATCH] linux-user: Fix sys_utimensat (would not compile on old glibc) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit c0d472b12e accidentally dropped the definition of __NR_SYS_utimensat even though its use is guarded by CONFIG_UTIMENSAT, not CONFIG_ATFILE. Some older glibc don't have utimensat() (even if they have the other *at() functions). Fix this by correctly cleaning up the sys_utimensat() implementation and #defines, so that we always provide the syscall if needed whether we're doing it via glibc or not. Signed-off-by: Peter Maydell Tested-by: Laurent Desnogues --- linux-user/syscall.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cdd0c28..f7877c3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -338,6 +338,7 @@ static int sys_openat(int dirfd, const char *pathname, int flags, mode_t mode) } #endif +#ifdef TARGET_NR_utimensat #ifdef CONFIG_UTIMENSAT static int sys_utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags) @@ -347,12 +348,19 @@ static int sys_utimensat(int dirfd, const char *pathname, else return utimensat(dirfd, pathname, times, flags); } -#else -#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat) +#elif defined(__NR_utimensat) +#define __NR_sys_utimensat __NR_utimensat _syscall4(int,sys_utimensat,int,dirfd,const char *,pathname, const struct timespec *,tsp,int,flags) +#else +static int sys_utimensat(int dirfd, const char *pathname, + const struct timespec times[2], int flags) +{ + errno = ENOSYS; + return -1; +} #endif -#endif /* CONFIG_UTIMENSAT */ +#endif /* TARGET_NR_utimensat */ #ifdef CONFIG_INOTIFY #include @@ -8536,7 +8544,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, goto unimplemented_nowarn; #endif -#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat) +#if defined(TARGET_NR_utimensat) case TARGET_NR_utimensat: { struct timespec *tsp, ts[2];