From patchwork Fri Jan 18 21:30:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156088 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3751114jaa; Fri, 18 Jan 2019 14:04:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN5zvGRvcC/vA79pH9YQO7Q2wO/vNL7xGFV5P1hyiY9YKZqVZp2PI4nJCUUG6P+318if4Pgw X-Received: by 2002:a7b:cb18:: with SMTP id u24mr16371725wmj.138.1547849099456; Fri, 18 Jan 2019 14:04:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547849099; cv=none; d=google.com; s=arc-20160816; b=nlX2lra/EelRRX445kYauSPSDu2h7Cbv4DrHADT6MgFE0SJ04FxKP8DZOu0KHZZh0F KxGsxuhTYO5VosJgXJ9nLcUAFpNV9h7NEP4nF5acUJs2NtVrXAOmeXBhZQH4h/bBEaTa LhvsWBTJCNDqruJRD+RLXyM2cUElNs9GJ2LpveJKLYDwML77Xm/KfkwL9WrD3xOzwCmw SVvUgwmP0EM+YdeNMd9UuNuiUVPf6sNDqQwZj0spXHmVTYx6sMMNCF6Pmm/bOvT5c9a6 l6NNbEPcxQCUqm8nDxDCCM/N/VwI9AKYOYhjRfwIGMbs48Euc+LexV6ZwZeA4DaqHDKr 75uQ== 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=hmuO8q5HCd/lfOBJ33u/IYvoVONCPzg6P8Xq5WUIsgQ=; b=cjILEeIlr5skpEGJrCFgrfC6Dsk7iqroz18EdZRkdL8/rmlEHhtmoDXPfUPDtU41jB eR6L74qsz2sZSYOWBba3fwIAVQU2Zb4BUxSNu//3Lb93jepwX7WufF1OteBQx5iBRclq cT/ilblOJcH7ijwxFCWhm/l01/CL1JcCzeYOrGVqVO15ekGbkMRKqKvVRCcg/ShXfb+G kh02CzuOmQ7WW6vavhJzJJecZDvt3Z4reuCgRKj/Ow69xitn3A/PHEAo/KAlGYO11aq6 ryVQsGKp7d+/iXTSD90SOLNZuIGApHG7yFdFmqAjEfnx++Zmoei+TZ2vzBigW59Qg0OJ ygkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JlGVG4iQ; 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 x16si59307569wrn.206.2019.01.18.14.04.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 18 Jan 2019 14:04:59 -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=JlGVG4iQ; 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]:47842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkcG2-0006ND-FT for patch@linaro.org; Fri, 18 Jan 2019 17:04:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkbke-0005MB-IG for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkbkd-0004t6-MG for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:32 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:36043) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkbkd-0004r5-AK for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:31 -0500 Received: by mail-pg1-x543.google.com with SMTP id n2so6650154pgm.3 for ; Fri, 18 Jan 2019 13:32:30 -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=hmuO8q5HCd/lfOBJ33u/IYvoVONCPzg6P8Xq5WUIsgQ=; b=JlGVG4iQ3sApX5NE0K9+HxL5+N/lPcqMn4BIsk6TkzOnijcxaLSG4IW1DTzBP5Lo0n vh0a+zFRiAJqqBTyvLiO9UeZXHP8XJ/l8VsXM+WXO3KbWT0KnE31rANfJMwavHblua0y /ZRS99DXDa82RRSf0BfHoufZhYo/yGM17rw04= 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=hmuO8q5HCd/lfOBJ33u/IYvoVONCPzg6P8Xq5WUIsgQ=; b=mYWS+0NxGEx+zNOS1rgWkxIxKeFvMVVwXfdCcHFnBYSlrkE8EcwkruSoXHurxwuWim f8m4mO6xJFefWHKxoqBRy1MXsHz0JY7HS5KUWZxl8d/GhiiJS1pfG7s/+0xpCFP819C1 aSruJBItansIGiRLIRYacL0E2vckj72TGQmEFc2GX+WFiStY53zR9ifqB6YoBnWDdJBl XEYMDHW/GnblT+lWLwhKOtvVs3TvkuULqkNxq80Jhmn+MhUBJIp81eKqYqGDhYDF4sTX R0QUMu3uGjfT8lEY1JjvLnqTf072lBJJq3YP7VdX5TTteS76isR9Gh66si9J+hwvmplf Z56g== X-Gm-Message-State: AJcUukftj14yqNu6DwA/pSrXTUJCBtYkPrm9OfcVT0tyTefwBwr9qMIi ZGys1zHolYFXpSLi7Mk92vGQU79gAQ4= X-Received: by 2002:a63:2109:: with SMTP id h9mr19162227pgh.277.1547847148882; Fri, 18 Jan 2019 13:32:28 -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.32.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:32:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 19 Jan 2019 08:30:59 +1100 Message-Id: <20190118213122.22865-26-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::543 Subject: [Qemu-devel] [PATCH v6 26/49] linux-user: Split out chdir 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" Note that chdir is universally provided. Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 1 + linux-user/strace.c | 12 ------------ linux-user/syscall-file.inc.c | 14 ++++++++++++++ linux-user/syscall.c | 6 ------ linux-user/strace.list | 3 --- 5 files changed, 15 insertions(+), 21 deletions(-) -- 2.17.2 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 392bd1579c..3fad9d51f0 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -19,6 +19,7 @@ SYSCALL_DEF_FULL(brk, .impl = impl_brk, .print_ret = print_syscall_ptr_ret, .arg_type = { ARG_PTR }); +SYSCALL_DEF(chdir, ARG_STR); SYSCALL_DEF_ARGS(clone, ARG_CLONEFLAG, ARG_PTR, ARG_PTR, ARG_PTR, ARG_PTR); SYSCALL_DEF(close, ARG_DEC); #ifdef TARGET_NR_creat diff --git a/linux-user/strace.c b/linux-user/strace.c index 43865e9df9..5133998c4f 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1113,18 +1113,6 @@ print_access(const struct syscallname *name, } #endif -#ifdef TARGET_NR_chdir -static void -print_chdir(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) -{ - print_syscall_prologue(name); - print_string(arg0, 1); - print_syscall_epilogue(name); -} -#endif - #ifdef TARGET_NR_chmod static void print_chmod(const struct syscallname *name, diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c index 2dd57176b3..7a4751d460 100644 --- a/linux-user/syscall-file.inc.c +++ b/linux-user/syscall-file.inc.c @@ -16,6 +16,20 @@ * along with this program; if not, see . */ +SYSCALL_IMPL(chdir) +{ + abi_ulong target_path = arg1; + char *p = lock_user_string(target_path); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(chdir(p)); + unlock_user(p, target_path, 0); + return ret; +} + SYSCALL_IMPL(close) { int fd = arg1; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3a027651e3..1cdc9727a9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5331,12 +5331,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_chdir: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(chdir(p)); - unlock_user(p, arg1, 0); - return ret; #ifdef TARGET_NR_time case TARGET_NR_time: { diff --git a/linux-user/strace.list b/linux-user/strace.list index 202bfa8f9e..357984dd6f 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -61,9 +61,6 @@ #ifdef TARGET_NR_capset { TARGET_NR_capset, "capset" , "%s(%p,%p)", NULL, NULL }, #endif -#ifdef TARGET_NR_chdir -{ TARGET_NR_chdir, "chdir" , NULL, print_chdir, NULL }, -#endif #ifdef TARGET_NR_chmod { TARGET_NR_chmod, "chmod" , NULL, print_chmod, NULL }, #endif