From patchwork Sun Jun 10 03:00: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: 138088 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2579268lji; Sat, 9 Jun 2018 20:12:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK4yvs0ci93HKjeS5hqW7bbgaq9ic9L72Wc6FZip3wIBD9J2LPzG0S7cY2ul32yvXBjx8sB X-Received: by 2002:a0c:99df:: with SMTP id y31-v6mr10758514qve.156.1528600349298; Sat, 09 Jun 2018 20:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528600349; cv=none; d=google.com; s=arc-20160816; b=doKKajr5jYua+/EgmIaZ2zGUxFZTPQULmaQpggwrGqgcRjew3AOKCAtDZDfUT07rDy 5j7ct7D30rP7KTAZ5etVD69uKBJj0sOA8V9ilO6b3/seUms5KCrQet5bphEuYhsnUpJf 4TZ2Ok648QDKOtucXn9bZddGeYoo8Nf62yQhG962ZsjwuVYjqYGVQ7Cy1r2G9OJjF9BL o02dspa6t9UiAbM63lip6wBYtkIZw8WIEzgcJCzN7tvKZ+QKLXHjKpXv26uUTVE1PnAt I6B2CHtPYJ6I54qToall+68JNyv9AHkGmSXOLr3PqrxUp4UnQvaeaFmuot4aFUEqae0h qQug== 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=mfT8RXdklKBfOd/G0853qiQYk5u1vwyyzpvmzW8G+v0=; b=g0nXtZcrCAwOlBmyGN/Qa/oHTPbyrsloF79lMLFeE+mNjfKcC6UpKuDtDk/xqItMGq 7mW6Dlal+rHQeP6Ov0XmqCbWNPkiu8qnRbegbxfprURZhntktW4smp6kvriKujFfxj5A ZugP2PEBdsDNG5XTeIU/0dkKYq85qVbURgQuX+7hwGErno5AYSP/o8OWfyEp+A6Fsk+x EWsSYwYQFRf/PrBDO9Nq2xvFllzJ2F8MrLE6dBMAoCG7FhABp3Qco5Rkrm3a1gkYZ1Mc UD7V9s9Ysa/9Lkc/9iywtAqsKkpCy+bCB0DLYLtyWZ8FYbZa7PKWnfZS01XTyl6whVue OCLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UO58uWjj; 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 f3-v6si4276285qvl.57.2018.06.09.20.12.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:12:29 -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=UO58uWjj; 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]:42224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqmK-0001n9-Id for patch@linaro.org; Sat, 09 Jun 2018 23:12:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqdD-0001zS-Hw for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqdC-0003IF-Pc for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:03 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:32936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqdC-0003Hy-KA for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:02 -0400 Received: by mail-pf0-x244.google.com with SMTP id b17-v6so8494408pfi.0 for ; Sat, 09 Jun 2018 20:03:02 -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=mfT8RXdklKBfOd/G0853qiQYk5u1vwyyzpvmzW8G+v0=; b=UO58uWjjawzOcm7ksW3lpVHV0tqUoaZgMArt8VpCNwyBcz42Iw0Y5SSjJFSuo4f/Wh GalL2BmaLijfhQ1I/6kL/d7YU7WLGLBwf3SSL1hyk6JqexFjIIvOqyqkLYk3N921whpF vN4m1CLQIztsqF8EIXCIRTr6XBQp2D55PM4yA= 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=mfT8RXdklKBfOd/G0853qiQYk5u1vwyyzpvmzW8G+v0=; b=jA/z0INlqcSaJS4IQSvqTxsJK6a3shjWj0XyuUDKId3+uJwvwGkG0xbZuT/D470Awb hTEr+A2w+iSJ2FwCi4Iu4EPUxYwQi+tMotC2EnjRUlfohOUCfHFt8ldoeu/BX1HSPLjR W1wcYR4/taunEPxw1rOFpFgls47FC5GA9NjC3Cq7PzzocavWj2ONnV3rJvjUk1eTCIHj mAyTLeA8EqZAqz+B96NNO+bmuWMr6Nu1PYj0cSQTH+eLYwig1B/oakjHDlx26WuEIg70 O9lVcdgtKoAL8rSsZ+VonXakIp7nrUdPCCpYbbXbo8DGsJS1tpr0p6s8NArDc1PwGO7p xYGQ== X-Gm-Message-State: APt69E2F2mnnq3Aa+mi9gnPaT6s5CAU9kpKIhB+UQP3QC0mGnJ0w8gsL wNgeAu0Jz7JOVpL2YIYNZfmlZpCdF9Q= X-Received: by 2002:a63:7206:: with SMTP id n6-v6mr10228598pgc.174.1528599781382; Sat, 09 Jun 2018 20:03:01 -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.02.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:03:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:00:49 -1000 Message-Id: <20180610030220.3777-18-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:c00::244 Subject: [Qemu-devel] [PATCH v2 017/108] linux-user: Split out unlink, unlinkat 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" All targets define unlinkat; remove the ifdef. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 48 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 936c7a7484..e1b3c7e827 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8227,6 +8227,34 @@ IMPL(read) return ret; } +#ifdef TARGET_NR_unlink +IMPL(unlink) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(unlink(p)); + unlock_user(p, arg1, 0); + return ret; +} +#endif + +IMPL(unlinkat) +{ + char *p = lock_user_string(arg2); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(unlinkat(arg1, p, arg3)); + unlock_user(p, arg2, 0); + return ret; +} + IMPL(waitid) { siginfo_t info; @@ -8300,22 +8328,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_unlink - case TARGET_NR_unlink: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(unlink(p)); - unlock_user(p, arg1, 0); - return ret; -#endif -#if defined(TARGET_NR_unlinkat) - case TARGET_NR_unlinkat: - if (!(p = lock_user_string(arg2))) - return -TARGET_EFAULT; - ret = get_errno(unlinkat(arg1, p, arg3)); - unlock_user(p, arg2, 0); - return ret; -#endif case TARGET_NR_chdir: if (!(p = lock_user_string(arg1))) return -TARGET_EFAULT; @@ -12519,6 +12531,10 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(open_by_handle_at); #endif SYSCALL(read); +#ifdef TARGET_NR_unlink + SYSCALL(unlink); +#endif + SYSCALL(unlinkat); SYSCALL(waitid); #ifdef TARGET_NR_waitpid SYSCALL(waitpid);