From patchwork Sun Jun 10 03:01:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138156 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2606955lji; Sat, 9 Jun 2018 21:02:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIK7uTO8pM6/iWF6zZG6pRIUqxfbX4lItqXiET5DS+dWu1I7uzpHn8xhWfPUzuGB7+zJGuA X-Received: by 2002:ac8:3805:: with SMTP id q5-v6mr11936124qtb.410.1528603374407; Sat, 09 Jun 2018 21:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528603374; cv=none; d=google.com; s=arc-20160816; b=R0Mjiim7aEQI+SoQ8uQJSENkNtWxvOkN+uTFX3aP+BgZ72F9gEWjhur0HO7qGhgxZi 8D1a+rvrmuCXwl7TyPqp+KTZtfPE20Z+fMuNg9XTsabrbIUuHclmue9sQW4K9LqI2/Xz Y+Y8faQDtbLWzssKOu/3kNurfMjPUOa0CPDCHRyEiVbO0VcMKp3slHWyiIzFLID8eD4D m05xTHtrm6/LG2Q0CwipSTnm3uVJBanOgC4chgcXLajVyao0wq52d5eOH7fHVtlLseNS YVPsBeHoz8CYtZvs0F/U//rwbF2U998TMy4wK2h0EW7ruFQDf8AZV3FAGvOFbGCcZIS+ +byw== 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=iMs2Z8N1qvLee4RKGzCZHqwUUHVJYzMlAhUPAV95u24=; b=H9D6IkgN7rAYq0UmsHONVp7ElhnhRzxEwCEf3GfAI0HezjaELyXdxIkHPXd6wQYuJG jVGfOE4N+uBB1p2N2DQX/dcDrDPnxOaaHU0faUrInQBiRadGYS7dvhVJVnkLwbagzKU8 D4VRdWe7B7BUR0Fr2XH1fhXEcNIOnImhWQrUKl1pH1BX15ysMlBIfPZOhfP+zbxJw9eD jJurJugxxjinXU2+Kq6tCTFfpMPE6UyUhKk6UXdaXArsZ+a7UggbyBdI/XN7YOdC77VY NIOm0nc0aKGfGv+vxtSGv3kOsxDAKpb8kbaMq+bLw+d7UvwMYVHUVSh+S7VhwRpLK8Ib JSrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hf5DFGMm; 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: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 17-v6si9447025qkm.57.2018.06.09.21.02.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:02:54 -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=Hf5DFGMm; 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]:42510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrZ7-0006tJ-SJ for patch@linaro.org; Sun, 10 Jun 2018 00:02:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqf7-0003jk-3h for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqf5-0004EJ-Ua for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:01 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:44111) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqf5-0004DM-Mq for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:59 -0400 Received: by mail-pl0-x242.google.com with SMTP id z9-v6so10387518plk.11 for ; Sat, 09 Jun 2018 20:04:59 -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=iMs2Z8N1qvLee4RKGzCZHqwUUHVJYzMlAhUPAV95u24=; b=Hf5DFGMmS6R3yNFJwltXyXMQzjJeEjcrCjnAOSVr2O65Kw5eNo+grrlap1CJRYhAqE /l/j7kgMalSm7yBmXtek01AHsCrwNQPFEpiOVYaHE+iOytMNBX4qB1lYwxYZaf91bYCP 3By6KCSiXkTiQCxA1kya5RO9SNBshcrCZcEQM= 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=iMs2Z8N1qvLee4RKGzCZHqwUUHVJYzMlAhUPAV95u24=; b=WTUqbRH4uJ31FC43SXq+KepJxHWNTjWhNRtJYfVlCkkfQgI969+2zWpt1PGHy9jAuF dnJBLwHInUvVLR0ze3nwrr/ir+I9sDGZdRxZpGSAYNWYccqPX5mUFdJamOrBnElfidIE IBYsGQLHp5sWP7VxSfpg7Mdlqz5GoICPcFZZynR0qYFrUcWyHyOhOfGhnraY6QVJqSPK 78FcQib8C/BJVpbcu7VlIDocNiGDlrhEkACjQpn1T751cSNZeQZlGYrsct3aWJfccgDT rIB2KjD5+DsVdOg3MYXonLtEzCAZ7iC7sqAb2oAP52nnx9TrgCQZ6G4O+kISYT7qzEub p6qQ== X-Gm-Message-State: APt69E1QAj2lSWvjiawHKCu7PFg22LU+uL45H8JLKyC9unTbiYffABe8 vOJEGaeIODMhr/fU6Pi7lWedSPXa+iQ= X-Received: by 2002:a17:902:760e:: with SMTP id k14-v6mr12932756pll.310.1528599898563; Sat, 09 Jun 2018 20:04:58 -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.04.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:04:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:44 -1000 Message-Id: <20180610030220.3777-73-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:c01::242 Subject: [Qemu-devel] [PATCH v2 072/108] linux-user: Split out getegid, geteuid, getgid, getuid, lchown 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: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall.c | 82 +++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8d6b949b8a..f8e34d28b1 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8441,6 +8441,27 @@ IMPL(getdents64) } #endif /* TARGET_NR_getdents64 */ +#ifdef TARGET_NR_getegid +IMPL(getegid) +{ + return get_errno(high2lowgid(getegid())); +} +#endif + +#ifdef TARGET_NR_geteuid +IMPL(geteuid) +{ + return get_errno(high2lowuid(geteuid())); +} +#endif + +#ifdef TARGET_NR_getgid +IMPL(getgid) +{ + return get_errno(high2lowgid(getgid())); +} +#endif + IMPL(getitimer) { struct itimerval value; @@ -8584,6 +8605,13 @@ IMPL(gettimeofday) return ret; } +#ifdef TARGET_NR_getuid +IMPL(getuid) +{ + return get_errno(high2lowuid(getuid())); +} +#endif + #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA) IMPL(getxpid) { @@ -8769,6 +8797,21 @@ IMPL(kill) return get_errno(safe_kill(arg1, target_to_host_signal(arg2))); } +#ifdef TARGET_NR_lchown +IMPL(lchown) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(lchown(p, low2highuid(arg2), low2highgid(arg3))); + unlock_user(p, arg1, 0); + return ret; +} +#endif + #ifdef TARGET_NR_link IMPL(link) { @@ -11410,30 +11453,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_lchown - case TARGET_NR_lchown: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(lchown(p, low2highuid(arg2), low2highgid(arg3))); - unlock_user(p, arg1, 0); - return ret; -#endif -#ifdef TARGET_NR_getuid - case TARGET_NR_getuid: - return get_errno(high2lowuid(getuid())); -#endif -#ifdef TARGET_NR_getgid - case TARGET_NR_getgid: - return get_errno(high2lowgid(getgid())); -#endif -#ifdef TARGET_NR_geteuid - case TARGET_NR_geteuid: - return get_errno(high2lowuid(geteuid())); -#endif -#ifdef TARGET_NR_getegid - case TARGET_NR_getegid: - return get_errno(high2lowgid(getegid())); -#endif case TARGET_NR_setreuid: return get_errno(setreuid(low2highuid(arg1), low2highuid(arg2))); case TARGET_NR_setregid: @@ -13094,6 +13113,15 @@ static impl_fn *syscall_table(unsigned num) #endif #if defined(TARGET_NR_getdents64) && defined(__NR_getdents64) SYSCALL(getdents64); +#endif +#ifdef TARGET_NR_getegid + SYSCALL(getegid); +#endif +#ifdef TARGET_NR_geteuid + SYSCALL(geteuid); +#endif +#ifdef TARGET_NR_getgid + SYSCALL(getgid); #endif SYSCALL(getitimer); #ifdef TARGET_NR_getpeername @@ -13121,6 +13149,9 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(getsockopt); #endif SYSCALL(gettimeofday); +#ifdef TARGET_NR_getuid + SYSCALL(getuid); +#endif #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA) SYSCALL(getxpid); #endif @@ -13129,6 +13160,9 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(ipc); #endif SYSCALL(kill); +#ifdef TARGET_NR_lchown + SYSCALL(lchown); +#endif #ifdef TARGET_NR_link SYSCALL(link); #endif