From patchwork Fri Jan 18 21:31:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156077 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3742925jaa; Fri, 18 Jan 2019 13:54:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN5kWQy5DhqFs7MkPcozwYGZZtrr3j+kS2xgYW/GJvo/d8mUDl/oV8DQAT5Ik0N/8cbEC4d1 X-Received: by 2002:adf:f8cf:: with SMTP id f15mr18266750wrq.265.1547848497076; Fri, 18 Jan 2019 13:54:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547848497; cv=none; d=google.com; s=arc-20160816; b=VRgtc+RY9W73W3SEHyMqYmbsHd/X1fUA4jkvKzo1XncVT0QM/MzSY1CtMoSmUYygoJ ZVNiLDEJekDjjORFKJn6kOo+jB34q2NrmHBT1OeG5p0QviAXBTfvSTqJLqSn/7njvm2C 6WI5Ln0artP90yt53ga+mpckrTLxr34J3ewTsjD2By3/H6yzWZRjCbnc1bKfYdaDxrwd UN76jMuAKCPYhgDA8pTpIe97uxAc2HZ5hdLVB5Dqiicm4ns7INCjp8rZa3F546Vol41s MY7Lu5MqaGBYThBdOKzpFiccZBpShTyM2LujRM7PX/m8J3Tgqo9jf8DC4IUpPu1jdldk DXVQ== 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; bh=cKg8c0GdaGBrpr59vF70WkJKA+3W0/Fdq6RBztRFrcQ=; b=w+IN0KbaUCaZT39J90cnCwVNGls7jbSGPYRWAKIYMX3xTzNSC51jh5VBIt8Efxblle 6vxrHByQ0q6NWzUt4CZ9ur+I96vnlRdy6lHb9pBQ0TghFikadLCqnQiChwaDNayJkHHW 3/E/LMr0aOOT80SRPrx6Qk98EbUfA2ArRWBEzlGy/V66vu+7nWK3ycwsKqhWz99IOF2w 89brtohUhKsK8dh/SbvVgqVWkrw1dEzLFYS49GUVBCRZ0PTWVg2nw8Cm+aJ/RnxwHLQF fB2fsCOx3SgQnTSdQfaFYeG9DR+1VWO/RLEQARrSkUMzZFIX/i7Dzqp5sYUP2Nkzoq7Y iMMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jmi5XAv2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id c192si27457698wme.168.2019.01.18.13.54.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 18 Jan 2019 13:54:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jmi5XAv2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:47698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkc6J-0006iD-V3 for patch@linaro.org; Fri, 18 Jan 2019 16:54:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkbln-0006CE-ON for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:33:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkbll-0006KO-PM for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:33:43 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:33674) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkblj-0005mP-Nx for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:33:39 -0500 Received: by mail-pg1-x544.google.com with SMTP id z11so6661606pgu.0 for ; Fri, 18 Jan 2019 13:33:15 -0800 (PST) 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=cKg8c0GdaGBrpr59vF70WkJKA+3W0/Fdq6RBztRFrcQ=; b=jmi5XAv2YXgxL8KDT6flfBMd049avg8BLp4V6eMKGOyZw02EPj4YG/eW9EIL/1HL/O KkTyvaPz0NHs0QLvT2bQNBcSeO9ysw2R/nMfFZCydwcZ1yhSb5kdfANIsaHQrXg7CkSe 2NkrEgbc3lKHNzzcLcT1T0VHZSnOmFZMWvqW0= 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=cKg8c0GdaGBrpr59vF70WkJKA+3W0/Fdq6RBztRFrcQ=; b=c1mBWdlDcAzlaeqJYj7R2zuOYOtXYKrBxmPIuda+ikhSS/JRT6hCscVrqhLh6dJ9ce WlM6/hPL8qtOvjLmcVCtfm+eXv33QxkTpVPpalbTLRhOAa/g9U2sX3SklhQuChu7jvX+ tDsBK8SAQLh+1NBkkU6PuW80WuuILpyQvX/mkng7yXfgrbIA/3MncpPSTsAtDMB7IFmP H3jaUB+vVzXdHjSc3KO1GRvg6cB9FL8ML9DWW/8iJPKo0a3tdiM9Gq8V/QM5Iu2UDEgX qCr4ip9ZtKdE62UBM/JEWJEWftiozqAtAGbs6SAWn3l7WiqilhnHKAg4dYq6mnkT8CUl g/hQ== X-Gm-Message-State: AJcUuke6D6DBTyUqspQHVkFL81wOAPROHdzWi87yxJYDXBYOKoWj6WW9 CjhE9dxeJsnkCMcaU/z4Vf0lAvkyBhU= X-Received: by 2002:a63:9a52:: with SMTP id e18mr19379832pgo.14.1547847194678; Fri, 18 Jan 2019 13:33:14 -0800 (PST) Received: from cloudburst.twiddle.net ([2001:8000:10e0:a000:c673:a6b6:fdef:1933]) by smtp.gmail.com with ESMTPSA id v12sm5833667pgg.41.2019.01.18.13.33.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:33:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 19 Jan 2019 08:31:19 +1100 Message-Id: <20190118213122.22865-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190118213122.22865-1-richard.henderson@linaro.org> References: <20190118213122.22865-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v6 46/49] linux-user: Split out acct 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-defs.h | 1 + linux-user/syscall-file.inc.c | 18 ++++++++++++++++++ linux-user/syscall.c | 11 ----------- linux-user/strace.list | 3 --- 4 files changed, 19 insertions(+), 14 deletions(-) -- 2.17.2 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 25d5aaccd1..f8f280f376 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -19,6 +19,7 @@ #ifdef TARGET_NR_access SYSCALL_DEF(access, ARG_STR, ARG_ACCESSFLAG); #endif +SYSCALL_DEF(acct, ARG_STR); #ifdef TARGET_NR_alarm SYSCALL_DEF(alarm, ARG_DEC); #endif diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c index 90aacfacaf..dd0bf877d5 100644 --- a/linux-user/syscall-file.inc.c +++ b/linux-user/syscall-file.inc.c @@ -36,6 +36,24 @@ SYSCALL_IMPL(access) } #endif +SYSCALL_IMPL(acct) +{ + abi_ulong target_path = arg1; + abi_long ret; + + if (target_path == 0) { + ret = get_errno(acct(NULL)); + } else { + char *p = lock_user_string(target_path); + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(acct(path(p))); + unlock_user(p, target_path, 0); + } + return ret; +} + SYSCALL_IMPL(chdir) { abi_ulong target_path = arg1; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d0bf339281..33d536262f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5293,17 +5293,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_acct: - if (arg1 == 0) { - ret = get_errno(acct(NULL)); - } else { - if (!(p = lock_user_string(arg1))) { - return -TARGET_EFAULT; - } - ret = get_errno(acct(path(p))); - unlock_user(p, arg1, 0); - } - return ret; case TARGET_NR_ioctl: return do_ioctl(arg1, arg2, arg3); #ifdef TARGET_NR_fcntl diff --git a/linux-user/strace.list b/linux-user/strace.list index 4ea11f162e..9f2f8977b4 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -9,9 +9,6 @@ #ifdef TARGET_NR_accept4 { TARGET_NR_accept4, "accept4" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_acct -{ TARGET_NR_acct, "acct" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_add_key { TARGET_NR_add_key, "add_key" , NULL, NULL, NULL }, #endif