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: 18034 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BBB6E2397B for ; Thu, 20 Jun 2013 15:57:26 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id b12sf6259053wgh.10 for ; Thu, 20 Jun 2013 08:57:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=V9ZLbsj3uBknyyv+KZ5c+UwLzcj/3yLxXeOqxlk+hq8=; b=iZWwXFpnDPWGo4VgJokoxkgSqZVAqWBVU18sVTEzGeO+WdLxdwvuTDsPQi49+DB79l b0cnG2z6I2vEJu/PbN6vuJe4frsZkKkjYxsDuv03vCWavoHvbO7BC0XPuCUSY1LnZwaN +LY3U7ijr2l5tJ3ePRdbwemeR0PFJd+6eo645ZyEMTlQnM+TdO3rQOYu7TOyiSoZ2Rsq t00A8eCUr8Ehkp/9xkFOzmZ8d/IvZFXvw34AMDjEo6OtEP11iyzOj9jljCuhFBqetIFw xi8h+QuJ9wG/DR9Xe1aveKDiL9ZbYQQXrQg+NfYAXJI4BQwSgvb2hdqt7yajMe13P/Zu oEsg== X-Received: by 10.180.76.76 with SMTP id i12mr51455wiw.6.1371743845845; Thu, 20 Jun 2013 08:57:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.8.37 with SMTP id o5ls170835wia.50.gmail; Thu, 20 Jun 2013 08:57:25 -0700 (PDT) X-Received: by 10.194.170.168 with SMTP id an8mr6205143wjc.72.1371743845643; Thu, 20 Jun 2013 08:57:25 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id t9si4949920wiv.63.2013.06.20.08.57.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Jun 2013 08:57:25 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id m1so5241017ves.28 for ; Thu, 20 Jun 2013 08:57:24 -0700 (PDT) X-Received: by 10.220.53.7 with SMTP id k7mr3080225vcg.52.1371743844532; Thu, 20 Jun 2013 08:57:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp26881veb; Thu, 20 Jun 2013 08:57:23 -0700 (PDT) X-Received: by 10.194.103.73 with SMTP id fu9mr6216237wjb.70.1371743842978; Thu, 20 Jun 2013 08:57:22 -0700 (PDT) Received: from mnementh.archaic.org.uk (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]) by mx.google.com with ESMTPS id ub6si393637wjc.68.2013.06.20.08.57.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 20 Jun 2013 08:57:22 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; 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 Cc: patches@linaro.org, Riku Voipio Subject: [PATCH] linux-user: Fix sys_utimensat (would not compile on old glibc) 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-Gm-Message-State: ALoCoQnoDtPVYbHJFooQeamZoRoZDOfslW1XvNG5gfTj0J613t1a+gAzLfcYl9ulOdxZFbURoDG9 X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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];