Message ID | 20180610030220.3777-42-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2588048lji; Sat, 9 Jun 2018 20:28:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKeDk8wmsrjcurUhMOWMTAbr8V2cNeF/mgRamhqsGjDuzszTNfo9NjwmemwOoVA8jOU66qF X-Received: by 2002:a37:1399:: with SMTP id 25-v6mr9998637qkt.83.1528601324141; Sat, 09 Jun 2018 20:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528601324; cv=none; d=google.com; s=arc-20160816; b=Utw4hhf0pyLy33hfIB8CLNVLrP+c6OBP6JU/iFfLjnofjgQs5j2+oqDu8TMkwTrpZ5 Bv6aqtMU/YGP8i2VwEiCNG7O9io0b7dDOionADOR31z1l1K6VrXygPaVdapYsvN9loEg Tqk7E7DuTTbZZE5nIpnrf5DD+EXy7Q/eVur97XKstMzsITs3jUAFb96iKmVDVfTp6u6g omR33CT9orGtdDrwQ+IZiqw0Zi6c/2fOy+Ql2XdAQlqzpys1G4CDRjy/9/leOlMOxqHg TGDl089/ZGmofnWvpYaFEdgP/Vkx/dzcOoTfVKviFYm0owdRnGvXPNW7Lsowsintk8oo DFQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=fJyw5nIy4yvt/fDKhgIoq5kfbDLbyImGxwi43b0Dc8s=; b=R/NLSgxycK1WXn5g8vu61dLekWlZPtIco3tgtxB7tHDv7q9sl0Ejx9vFZeZGX3ffj5 mtB2cMcJMAwN/vBGeyvKrRf7aX+kApDVOvyXxf1TyShBCR7wg0en7loIj6dQZcLFo3NM boki+yyN9CDoens92NZQebMjoJWKJslTUljHIlCBvZBu88T5jR/nLrdOhn2WWQEe7in3 jya69sDVwFk00UadkT5pxEWnB1N+OAi+ax6AvQ6FQ9P6Xf6+8HtzYFpLbR8EOmX/zIpj lS7TERVSVurR2cFagKawh/etihctqhW1gVgmtVZsxg6RCBhU5u+yFAQb/xaLZGeHTaOV Q8uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PCx1Aiu1; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u3-v6si6784963qvk.231.2018.06.09.20.28.43 for <patch@linaro.org> (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:28:44 -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 header.s=google header.b=PCx1Aiu1; 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 sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1fRr23-00072P-I1 for patch@linaro.org; Sat, 09 Jun 2018 23:28:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <richard.henderson@linaro.org>) id 1fRqe5-0002k0-2w for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <richard.henderson@linaro.org>) id 1fRqe4-0003dG-5h for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:57 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:47033) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <richard.henderson@linaro.org>) id 1fRqe3-0003d3-Ve for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:56 -0400 Received: by mail-pg0-x243.google.com with SMTP id d2-v6so8129667pga.13 for <qemu-devel@nongnu.org>; Sat, 09 Jun 2018 20:03:55 -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=fJyw5nIy4yvt/fDKhgIoq5kfbDLbyImGxwi43b0Dc8s=; b=PCx1Aiu17oZXwjMko2vH7+vH25URlrz5tYbCMf64c5y+E2d3P/WJ+2gHlPf4eqJq7A 33C7lNolG7xYZY2/4C7rCMi2f2YZK5hpOjcqsO4k3m2kh6c+jvTtX/egjrkMwwpw2Y8p LB0ZNtVv7lEItv3U2PSvyWYO25Q5fQfBVm9h0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fJyw5nIy4yvt/fDKhgIoq5kfbDLbyImGxwi43b0Dc8s=; b=SpYlowd8j36Ar2MtMSauVV7QKhjrC2FQ9doR+3kkrEejLKPtOYVXVzR+5U/jiqe0PF 7OMuftAD/QPGFfR0R55Zo2fV2q29aHRKjH24No8MqLAKD8GN6/y5grhjgKmL5UZrtt1u IfJwgqZ+0j1f3Uzc2K19L3CD5Ai30UIIndTHKUXD/DOa30jAsMZUsaSZpcKxo7o5lqVY 9ATT5u85/ZoWkAo74pvaiDpHbqrb3EqHuvE0hnJqGVw9omNyzcXg2hrMPz5UUNJY8O25 +3deGpmpfxfgPMppA4wa3Ipx6rNYfjTCjyRMgzSqrvkPzI/GMcCvl5MVGTnDKrsrcIdt uVLQ== X-Gm-Message-State: APt69E0GkstHmeimnhVmj4UCHwnd3tp0yB5Ecq7wsrlkMBPdhShyN6RH d5SrHc4zLFpcVC3GIS7BwK7iz2iZsC4= X-Received: by 2002:a63:7206:: with SMTP id n6-v6mr10230594pgc.174.1528599834820; Sat, 09 Jun 2018 20:03:54 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.03.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:03:54 -0700 (PDT) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:13 -1000 Message-Id: <20180610030220.3777-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH v2 041/108] linux-user: Split out fchmod, fchmodat, ftruncate, truncate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
linux-user: Split do_syscall
|
expand
|
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f79aebe869..df8422cd3a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8079,6 +8079,24 @@ IMPL(faccessat) return ret; } +IMPL(fchmod) +{ + return get_errno(fchmod(arg1, arg2)); +} + +IMPL(fchmodat) +{ + char *p = lock_user_string(arg2); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(fchmodat(arg1, p, arg3, 0)); + unlock_user(p, arg2, 0); + return ret; +} + #ifdef TARGET_NR_fcntl IMPL(fcntl) { @@ -8093,6 +8111,11 @@ IMPL(fork) } #endif +IMPL(ftruncate) +{ + return get_errno(ftruncate(arg1, arg2)); +} + #ifdef TARGET_NR_futimesat IMPL(futimesat) { @@ -9563,6 +9586,19 @@ IMPL(times) return host_to_target_clock_t(ret); } +IMPL(truncate) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(truncate(p, arg2)); + unlock_user(p, arg1, 0); + return ret; +} + IMPL(umask) { return get_errno(umask(arg1)); @@ -9746,24 +9782,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_truncate: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(truncate(p, arg2)); - unlock_user(p, arg1, 0); - return ret; - case TARGET_NR_ftruncate: - return get_errno(ftruncate(arg1, arg2)); - case TARGET_NR_fchmod: - return get_errno(fchmod(arg1, arg2)); -#if defined(TARGET_NR_fchmodat) - case TARGET_NR_fchmodat: - if (!(p = lock_user_string(arg2))) - return -TARGET_EFAULT; - ret = get_errno(fchmodat(arg1, p, arg3, 0)); - unlock_user(p, arg2, 0); - return ret; -#endif case TARGET_NR_getpriority: /* Note that negative values are valid for getpriority, so we must differentiate based on errno settings. */ @@ -12719,12 +12737,15 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(execve); SYSCALL(exit); SYSCALL(faccessat); + SYSCALL(fchmod); + SYSCALL(fchmodat); #ifdef TARGET_NR_fcntl SYSCALL(fcntl); #endif #ifdef TARGET_NR_fork SYSCALL(fork); #endif + SYSCALL(ftruncate); #ifdef TARGET_NR_futimesat SYSCALL(futimesat); #endif @@ -12870,6 +12891,7 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(time); #endif SYSCALL(times); + SYSCALL(truncate); SYSCALL(umask); #ifdef TARGET_NR_umount SYSCALL(umount);
All targets define fchmodat; remove the ifdef. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- linux-user/syscall.c | 58 ++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 18 deletions(-) -- 2.17.1