From patchwork Sun May 19 20:36:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164517 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4791237ili; Sun, 19 May 2019 13:59:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMzH5xo3zL5bRlL6lxsyuGXC0xBC3Qv15dz47W4ZBVRlvF6A4kXeNICsJqtzEGVcMNA+aZ X-Received: by 2002:a50:9441:: with SMTP id q1mr71195808eda.101.1558299586259; Sun, 19 May 2019 13:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558299586; cv=none; d=google.com; s=arc-20160816; b=G58nk4+jBdkKUWVYXh4SVJJSywr1DrepoNDMAfn3WdzqPkL6Um9nXFCno0fTmJ+mZF WdaG/v7w9P4mrrZRfOfuI0issZfywY3WokJqg3EHm0aAtSp9AlQx+RLRdUhOpBR8DsBW aMDVP6g1HS3wL8Ry7bIRERyMuPZaQ9+AkyZz9BBzvGnMfBUW6DAkB61vLAxddzJHlPsG Qa287tUdA+fcfkQb+Y81lrLhAb20WxWf5Tt33+RDoPoX3kNUtG0AKGiY3b8n5ZRy83Xf vszrWiu2swlpos3AQyqM4HI+cNB/4mqVjoC4welYI0SzK+pAdyVEa8gfpF0KHP3AQNxR SgbA== 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=F+fKej9fPmaDrSPzKASFQtBx9UbES7Ex48WVScqi++Y=; b=Js0AbkGXEDdd8oO/f9oW0C8WStKm5hhnNvnBLScUG4S79JNvqRptFHTrXklTEHHcYl OWxFcz8OBdkuayrELkEn8dlYB0j/0IyCkJdoRNSm22csnd7R1MsW0BNW3WeVtVNvnpzM RpVlSyVp/QPwwkGcswUaQr9bHesIZNrYawFI782fH1mq/ZXXBWGBt2QjcZhhKFSA7xE7 vMrruVFCHSqEG0rD5oUfgkMubeexdWx2uNDVUPjyIJ98r21SH5e0FqLASkKv31s2u9C8 qGDKec7IEQCZWljaAMdtdhOGx41pM/xWcnwqq42+0Pt6FGGy16o9ZRGfZUUUUnvepDcN ruSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AyIGZgac; 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 k17si3408694ejs.208.2019.05.19.13.59.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 13:59:46 -0700 (PDT) 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=AyIGZgac; 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]:53404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSuH-0004FF-6w for patch@linaro.org; Sun, 19 May 2019 16:59:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSZI-0003No-Ro for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSZH-0003z2-Os for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:04 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:42916) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSZH-0003y7-IH for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:03 -0400 Received: by mail-pf1-x443.google.com with SMTP id 13so6157230pfw.9 for ; Sun, 19 May 2019 13:38:03 -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=F+fKej9fPmaDrSPzKASFQtBx9UbES7Ex48WVScqi++Y=; b=AyIGZgacVo1RSvmJgHsjrxMNdHL0qO6O7OQoHEIjI6sQOu1zg1i8IuMjvWUDjcCCGO yW/1kZUtgIhqnnlF5WbemkE/r0epfOs0FbhBW8lbtEA6aK42VKZOHGlhBVUnu8CLCUoJ Di/UinbDRth9n8uSqEMu4N+9OxNqet3+w9pns9w5KdAXGJQOGwd0xtvU/6CFhkvhSrWT Bpi7hvMEI2Zb3QdWZko78kSNgewVZENWmqhwNRTe+c3wUj1I3B7tusF4XA6opr1xTpbO shNs8SmS7BN5Oihg0fqJsLQ4PNtI1LSJm4yTHg0qOhji1sDU4gyqvpQhIA6q0MUh6CC6 T4yQ== 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=F+fKej9fPmaDrSPzKASFQtBx9UbES7Ex48WVScqi++Y=; b=Ry2QXvOqb6LQl2ZWr6omxRW9LiE/5rrVTRNJfRdFtdAcDDdiN//1CBrozlq5IikZpL zlhnLsJalazoBbX1geDvTxBgFaMrrNstohyxFnabe0MA9La23Cg37ehEur+MdwS7WnmP YPjDL/KUSCOOUHwP7qD44iZBe6bq60wqz7KmUR3qbOIfwBVmKeLb2KQ/dfqM+yXayb2d 8Ll5OaojnuWXuTmCu6y6aJA6iNGSps0urjh4VHh6TdfQM3lvq59wy9kJpRAIF6LTqFJF qUUZjLmTnpdzMWRDNHSQ6tlANO6DfEAHm0NobkNrcE+uuSMFvf24icAlKRMVzIGeYn5w 888w== X-Gm-Message-State: APjAAAVQOY94pO0utIt/w07+A8ZWa/7l6CUDWUzbJiPCUW/PB0xMek/p Azo9Z3HxgBUMzdcwx+3GoEAzXTlHLtI= X-Received: by 2002:a63:d354:: with SMTP id u20mr22999650pgi.129.1558298282395; Sun, 19 May 2019 13:38:02 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:36:37 -0700 Message-Id: <20190519203726.20729-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-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::443 Subject: [Qemu-devel] [PATCH v7 25/74] 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.1 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 9d6c765715..b234274034 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_chroot static void print_chroot(const struct syscallname *name, diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c index 5acd8ecc10..76637fe71b 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 affcd81273..0bf5901014 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5384,12 +5384,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 c6bb475728..3f79159b63 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