From nobody Fri Nov 7 12:59:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547849185451879.4606889277591; Fri, 18 Jan 2019 14:06:25 -0800 (PST) Received: from localhost ([127.0.0.1]:47886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkcHN-0007XQ-PQ for importer@patchew.org; Fri, 18 Jan 2019 17:06:21 -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) 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) 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-Google-Smtp-Source: ALg8bN7JIqsjBB+n3g8HnUsXfq5a85q4FTyCwF2diD+M9PW9Hf0eObnLb7XR14dsw5d7JjBkbQsfEg== X-Received: by 2002:a63:2109:: with SMTP id h9mr19162227pgh.277.1547847148882; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(-) 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 =3D impl_brk, .print_ret =3D print_syscall_ptr_ret, .arg_type =3D { 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 =20 -#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 . */ =20 +SYSCALL_IMPL(chdir) +{ + abi_ulong target_path =3D arg1; + char *p =3D lock_user_string(target_path); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret =3D get_errno(chdir(p)); + unlock_user(p, target_path, 0); + return ret; +} + SYSCALL_IMPL(close) { int fd =3D 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; =20 switch(num) { - case TARGET_NR_chdir: - if (!(p =3D lock_user_string(arg1))) - return -TARGET_EFAULT; - ret =3D 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 --=20 2.17.2