From nobody Tue Feb 10 07:42:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.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 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527839189928518.9605919003247; Fri, 1 Jun 2018 00:46:29 -0700 (PDT) Received: from localhost ([::1]:47891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOelZ-0000Io-3n for importer@patchew.org; Fri, 01 Jun 2018 03:46:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOeWu-0005bg-07 for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOeWt-0000Xv-37 for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:19 -0400 Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]:36696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOeWs-0000X1-TL for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:19 -0400 Received: by mail-pf0-x22f.google.com with SMTP id w129-v6so12092166pfd.3 for ; Fri, 01 Jun 2018 00:31:18 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id c4-v6sm4431782pgv.86.2018.06.01.00.31.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 00:31:16 -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=DJHyjL+tq2NbJ5wT/xWlzt5ykrkXQ2pykteKcZn2KLM=; b=exp9jqN6xtuE2CnKloiKnxz05GgmCjjvgnZAi78f9/GHYwAmDu9abrvH7dhPMWIObg vykkttvqsmr3IYEbfFZ1uY1aZmleHy5KIJQQgsLklGwIcPan83EKKh7AFxdiCXQ4XpEn qAczLEN4zN5yoyfqe4c3qpLfnSu2aQXzlzSEw= 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=DJHyjL+tq2NbJ5wT/xWlzt5ykrkXQ2pykteKcZn2KLM=; b=gvIONJ8mTZS6NqIx9nn2+c3rfBiz9xpGang60DZ06679uSYt1iKB0ofoApXC0u74Pn ZoyQ11RHCfm4cWUWyRTpXdkUoizWFQKwZbwFOMCVZpTjbzFAmzOtumgl9izqDrqA3VJZ qbZ+uxCN/ZWZsPDvAMLINPr5Zx1kLY9ojrW03/WA6xA9rRWnK6UPe7jTbMvNzq7i28gO JFHUDLuE+HchM5cT8/3PXyf3UCQYrIx/8/eDgkORQWuzLdLCf6mJFGbsEMRwy+Zpp5dW Ii+CNO/GsHLTJRyyOTYpIAddQPoiumTU7+5Rh8vtYnUvrakvbWugq8nOAx9sy7EMCQyy qHlQ== X-Gm-Message-State: ALKqPwe5DGv0oZ1240tk9TjEkcf/XgaKby27z5LyS4+wL/fKQKzsGM/6 oNIWbsjZvi42pC7qkcPN+6c3ITmaR+s= X-Google-Smtp-Source: ADUXVKLWh7UfVWHVq4tBzhP4BDbu75SHmF4vpHb9v95Z4QAQ3DEq45eRHrMCkep4Tpc6i/W9q1PVgA== X-Received: by 2002:a65:6354:: with SMTP id p20-v6mr8085837pgv.437.1527838277660; Fri, 01 Jun 2018 00:31:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 1 Jun 2018 00:30:34 -0700 Message-Id: <20180601073050.8054-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180601073050.8054-1-richard.henderson@linaro.org> References: <20180601073050.8054-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::22f Subject: [Qemu-devel] [PATCH 17/33] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- linux-user/syscall.c | 59 ++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b5736436f8..bbe9d6d9fb 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8276,6 +8276,40 @@ IMPL(read) return ret; } =20 +#ifdef TARGET_NR_unlink +IMPL(unlink) +{ + char *p =3D lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret =3D get_errno(unlink(p)); + unlock_user(p, arg1, 0); + return ret; +} +#endif + +#ifdef TARGET_NR_unlinkat +IMPL(unlinkat) +{ + char *p; + abi_long ret; + + if (is_hostfd(arg1)) { + return -TARGET_EBADF; + } + p =3D lock_user_string(arg2); + if (!p) { + return -TARGET_EFAULT; + } + ret =3D get_errno(unlinkat(arg1, p, arg3)); + unlock_user(p, arg2, 0); + return ret; +} +#endif + #ifdef TARGET_NR_waitid IMPL(waitid) { @@ -8352,25 +8386,6 @@ IMPL(everything_else) char *fn; =20 switch(num) { -#ifdef TARGET_NR_unlink - case TARGET_NR_unlink: - if (!(p =3D lock_user_string(arg1))) - return -TARGET_EFAULT; - ret =3D get_errno(unlink(p)); - unlock_user(p, arg1, 0); - return ret; -#endif -#if defined(TARGET_NR_unlinkat) - case TARGET_NR_unlinkat: - if (is_hostfd(arg1)) { - return -TARGET_EBADF; - } - if (!(p =3D lock_user_string(arg2))) - return -TARGET_EFAULT; - ret =3D get_errno(unlinkat(arg1, p, arg3)); - unlock_user(p, arg2, 0); - return ret; -#endif case TARGET_NR_chdir: if (!(p =3D lock_user_string(arg1))) return -TARGET_EFAULT; @@ -12978,6 +12993,12 @@ static impl_fn * const syscall_table[] =3D { [TARGET_NR_open_by_handle_at] =3D impl_open_by_handle_at, #endif [TARGET_NR_read] =3D impl_read, +#ifdef TARGET_NR_unlink + [TARGET_NR_unlink] =3D impl_unlink, +#endif +#if TARGET_NR_unlinkat + [TARGET_NR_unlinkat] =3D impl_unlinkat, +#endif #ifdef TARGET_NR_waitid [TARGET_NR_waitid] =3D impl_waitid, #endif --=20 2.17.0