From patchwork Sun Jun 10 03:01:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138159 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2607332lji; Sat, 9 Jun 2018 21:03:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQWCL2JytbjV5ZiVxEUxSdlhrOzPei/MSxNGf8Lp1JPXUjDvrctgQMEYC+UpA6fBOn40LY X-Received: by 2002:a37:3c8a:: with SMTP id j132-v6mr10348588qka.266.1528603405734; Sat, 09 Jun 2018 21:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528603405; cv=none; d=google.com; s=arc-20160816; b=qC6rndYlFK5/T1dpNVYwboJbOOpp2Ms2kQf3oDEwj7nmND4HZJzKKWsFyMuZ5c7fbI 3ZZWAdcF6r+UI3CZ0bOkZ23Rc6fccv+atcAN9snxYcnxdP8a4UHJo59V2BQbC7VU/644 HOX+BeU4aQzWDbyVmIW2duc7UP8qErXA1h28ght742SNbLwkCP5WIJ361Yf2WgbjMHD0 ATZ7rLPydf4XBDzWswdimmH2lQ75+oEzApNYKAIpN4vacLGGiF4C8aaw/QidpFZMreN+ t3nB4G9qH3ib92QzKUdD/PY1HCi00JgrcpyxXhlYAi4kK3GLivs1r85FCxwELc8dfZPF NS8w== 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=h/36ytP56M6RmyXRMPuv0T4xjmPyu6N2o33pMb66D64=; b=G75C6pPyYW0SygFC1VOBNwaHthDC7VFCBOkMvacjoAhf6P0hJmNhLiHdtHnVg97nih RMMFhburQQyiqYP0QY+5bmhLXdZx5Q/up0N4dF3MgY80RMATiG0cxCyr9V5sUE4lRPTf +Zyb/1sx0Ev5HXXpfxgRjXHpGXAmWGTzCXrC/pJjH1h4r5oCn/LzUmrMGQRMvJ6zR6gh vqMQVIT5/6uhkABRhqRQ1IQ+HxFVobj9AClQF127HaCCUNzibpBUsfAYjZxmfyrBfFuy JFFD9VyDs/Ep02TA7lRIwf7eoCtiFTvf/3u7QcPSIjT5Mfpr7ydqYjCcCgPerlBsEoz9 6JsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kZxri0Ml; 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 l6-v6si12267066qvk.254.2018.06.09.21.03.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:03:25 -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=kZxri0Ml; 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]:42512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrZd-0006xH-7r for patch@linaro.org; Sun, 10 Jun 2018 00:03:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfG-0003sq-Dt for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqfF-0004L7-El for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:10 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:46239) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqfF-0004Kv-9A for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:09 -0400 Received: by mail-pl0-x243.google.com with SMTP id 30-v6so10377639pld.13 for ; Sat, 09 Jun 2018 20:05:09 -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=h/36ytP56M6RmyXRMPuv0T4xjmPyu6N2o33pMb66D64=; b=kZxri0MlOxPRhEk3x2FHG54xPsOeyW3cSNMKP+BAOtKGJNLcf8IpCzhcRabpJqlJzY NHAz5IhklghQ7EO1UE4CjC4nwnRQfMwosjgOou26T7/GPmED2KZjEU/Ke3/UQ7Byayqy 1p5xLsZGHzVedMcnqjKq2TYx2w22+jn9otGZA= 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=h/36ytP56M6RmyXRMPuv0T4xjmPyu6N2o33pMb66D64=; b=PrB41sc1NRz1AoIcyVbR9rbeO2Jr4gxy8+vOm3LfgKr+KEB0pV6dfIL+rcslGewVN8 8hEzncN7T9mzGYFHJvVa9TndoZcUvuo+g8EvYisgP+Co9H1iqsMVJvFbv/IwrJYG85Gb B1bRvGriSMCBGr23WbDpDw8zj61gLGq0IqcmsCtGBBKfsvWE84yqfGwCNVQL1pQ/UF27 v4HcFgnlQNaMTErME/kvwwf3gtJaiEsJyJ5Gcff/Fv2zcuqP+o2Cx5aGBkTKzvjLEWJY WqQ7hmlARPzIjK3HB64pK4xgfrN67oJrbUPJviWdI+ZlwXp7oTa2nNCsU/xwyN/nuFGM BnnQ== X-Gm-Message-State: APt69E2B6KCSfdmxgjaSzedBaPktj5H0BW6emoMnPTqWd55uvpAkWvNR HyB49KbKnK5CNNjHcVwtRl1w8zOr/3k= X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr2223938plb.255.1528599908098; Sat, 09 Jun 2018 20:05:08 -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.05.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:49 -1000 Message-Id: <20180610030220.3777-78-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::243 Subject: [Qemu-devel] [PATCH v2 077/108] linux-user: Split out getuid32, getxgid, getxuid, lchown32 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 | 83 ++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 33 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 76a66b56fe..17560ebd41 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8704,6 +8704,21 @@ IMPL(getuid) } #endif +#ifdef TARGET_NR_getuid32 +IMPL(getuid32) +{ + return get_errno(getuid()); +} +#endif + +#if defined(TARGET_NR_getxgid) && defined(TARGET_ALPHA) +IMPL(getxgid) +{ + ((CPUAlphaState *)cpu_env)->ir[IR_A4] = getegid(); + return get_errno(getgid()); +} +#endif + #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA) IMPL(getxpid) { @@ -8712,6 +8727,14 @@ IMPL(getxpid) } #endif +#if defined(TARGET_NR_getxuid) && defined(TARGET_ALPHA) +IMPL(getxuid) +{ + ((CPUAlphaState *)cpu_env)->ir[IR_A4] = geteuid(); + return get_errno(getuid()); +} +#endif + /* ??? Implement proper locking for ioctls. */ IMPL(ioctl) { @@ -8904,6 +8927,21 @@ IMPL(lchown) } #endif +#ifdef TARGET_NR_lchown32 +IMPL(lchown32) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(lchown(p, arg2, arg3)); + unlock_user(p, arg1, 0); + return ret; +} +#endif + #ifdef TARGET_NR_link IMPL(link) { @@ -11614,39 +11652,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_lchown32 - case TARGET_NR_lchown32: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(lchown(p, arg2, arg3)); - unlock_user(p, arg1, 0); - return ret; -#endif -#ifdef TARGET_NR_getuid32 - case TARGET_NR_getuid32: - return get_errno(getuid()); -#endif - -#if defined(TARGET_NR_getxuid) && defined(TARGET_ALPHA) - /* Alpha specific */ - case TARGET_NR_getxuid: - { - uid_t euid; - euid=geteuid(); - ((CPUAlphaState *)cpu_env)->ir[IR_A4]=euid; - } - return get_errno(getuid()); -#endif -#if defined(TARGET_NR_getxgid) && defined(TARGET_ALPHA) - /* Alpha specific */ - case TARGET_NR_getxgid: - { - uid_t egid; - egid=getegid(); - ((CPUAlphaState *)cpu_env)->ir[IR_A4]=egid; - } - return get_errno(getgid()); -#endif #if defined(TARGET_NR_osf_getsysinfo) && defined(TARGET_ALPHA) /* Alpha specific */ case TARGET_NR_osf_getsysinfo: @@ -13213,8 +13218,17 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_getuid SYSCALL(getuid); #endif +#ifdef TARGET_NR_getuid32 + SYSCALL(getuid32); +#endif +#if defined(TARGET_NR_getxgid) && defined(TARGET_ALPHA) + SYSCALL(getxgid); +#endif #if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA) SYSCALL(getxpid); +#endif +#if defined(TARGET_NR_getxuid) && defined(TARGET_ALPHA) + SYSCALL(getxuid); #endif SYSCALL(ioctl); #ifdef TARGET_NR_ipc @@ -13224,6 +13238,9 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_lchown SYSCALL(lchown); #endif +#ifdef TARGET_NR_lchown32 + SYSCALL(lchown32); +#endif #ifdef TARGET_NR_link SYSCALL(link); #endif