From patchwork Thu Sep 22 12:13:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 76756 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1974qgf; Thu, 22 Sep 2016 05:26:48 -0700 (PDT) X-Received: by 10.55.164.135 with SMTP id n129mr1606769qke.222.1474547208949; Thu, 22 Sep 2016 05:26:48 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n75si971929qki.21.2016.09.22.05.26.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:26:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn35U-0001Yy-BJ for patch@linaro.org; Thu, 22 Sep 2016 08:26:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2u3-0008Ag-Sc for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn2u2-0006Na-SF for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:14:59 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:35326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2u2-0006NN-Kq for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:14:58 -0400 Received: by mail-lf0-f50.google.com with SMTP id l131so65692495lfl.2 for ; Thu, 22 Sep 2016 05:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W46+KqGXzVkeU+Ftm/GdKy3EQzQAVWTOO5LeQP3bqok=; b=dkC2mMTr+4hUijpCw0oOxnY4j9+1P+ZBe1uP0tWXimvtXGTb3ntqKSB00rV3Mu6rL0 sM4UiGOZQaWLyS7mi0aagjan8n+6RChAXUgkIcxecIhLhWPUP2zDOkqGjSfcOnbb2QRo uBuNZxXD6lPgWrqwZquR8aignw0toTUJE642U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=W46+KqGXzVkeU+Ftm/GdKy3EQzQAVWTOO5LeQP3bqok=; b=XUXN93bHIkN2i0ddJMg2MWLBL9p8Ee61PAC1AL/lOm0mGbmcZUtnPAI7No1ZdBFnmU xLGAgYTFmZfiBrfBj1/NPIOviPLIjtdpdiwIBeVSZZDNmgYvCVxxWjh78tPU+d6GnTcX lF/gqWIOasYLolAz/Xxe0c+fhwC7na09ygVEaOzqUuY+/K3gIOthFkjZEGNJOQqLimT+ dxQUp9QY53X0xONf79X7KIL9Xt90KwZVJ9WkuBSnpQGbCrgvpQ28wcWBgAuL+Y7JJJVN vvzAJnx3gR0aMC5WOp9LqZbaRB9IjClk+ifzcSwfGh5/kA843a4Jw851J/AS2QpDFtFR dLXg== X-Gm-Message-State: AE9vXwMKdkN3/u2wVkcQBlwQ+HXnszkkiVlR8ZTYx9P80950mKn9mY1PYuBDA6yWsXtXw+YF X-Received: by 10.25.17.100 with SMTP id g97mr745282lfi.44.1474546437892; Thu, 22 Sep 2016 05:13:57 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id u14sm294378lja.11.2016.09.22.05.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:13:57 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Thu, 22 Sep 2016 15:13:25 +0300 Message-Id: <700fa58e4b9100d6bd77df06d2e5d1f457720c4d.1474546244.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.50 Subject: [Qemu-devel] [PULL 05/26] linux-user: Use direct syscall for utimensat X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The linux utimensat syscall differs in semantics from the libc function because the syscall combines the features of utimensat() and futimens(). Rather than trying to split these apart in order to call the two libc functions which then call the same underlying syscall, just always directly make the host syscall. This fixes bugs in some of the corner cases which should return errors from the syscall but which we were incorrectly directing to futimens(). This doesn't reduce the set of hosts that our syscall implementation will work on, because if the direct syscall fails ENOSYS then the libc functions would also fail ENOSYS. (The system call has been in the kernel since 2.6.22 anyway.) Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) -- 2.1.4 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 51f558d..21ae996 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -520,16 +520,7 @@ static int sys_getcwd1(char *buf, size_t size) } #ifdef TARGET_NR_utimensat -#ifdef CONFIG_UTIMENSAT -static int sys_utimensat(int dirfd, const char *pathname, - const struct timespec times[2], int flags) -{ - if (pathname == NULL) - return futimens(dirfd, times); - else - return utimensat(dirfd, pathname, times, flags); -} -#elif defined(__NR_utimensat) +#if defined(__NR_utimensat) #define __NR_sys_utimensat __NR_utimensat _syscall4(int,sys_utimensat,int,dirfd,const char *,pathname, const struct timespec *,tsp,int,flags)