From nobody Sat Feb 7 06:21:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D96F4374AC7; Wed, 29 Oct 2025 12:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761740632; cv=none; b=WPKGcaR6PI9eaH1RyxKB2B8JoLM5wdFwjo3fHkUVOcgiEvQz9lr4AEO1YqCHGT5uIUEPuLOrmcUNE3ycBMrzdfqMMEX65/Yh0RVR1dT7hTYQUxjowlhqF3Mvwvt+G1/c5UsTvU0JDV2b/InN4fEhFoK6SwExfmd7a7QIY4CY+E4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761740632; c=relaxed/simple; bh=WU3OpDiHSBOB5eonlPoaP8MJGbmszqupW5dQlbeASiQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S33/7oW74O+w+08CyoQ4yMTVMnbval5G0l6RK63vEHZjre8FFcS8fziydVaPbkttUpqBk1DVR/6kHCv3BD9YNhkbvVtX3hf/nrr7wo4h1wflK4tr9tE7AHSn2cis5zuKIFF5f9pdMgtbTKYvFzSf2KyVCTRoIdt+YvZKnnc/w9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L+FPOYdD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L+FPOYdD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9E86C4CEF7; Wed, 29 Oct 2025 12:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761740631; bh=WU3OpDiHSBOB5eonlPoaP8MJGbmszqupW5dQlbeASiQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=L+FPOYdDZZo/BeqdGByNQMyfLG+Kt3tsoH4nlwcYDBngbxLfcUNmcdy72T3ESY8vc tUVDct/m8Yf0qHEJWYNBdijhe9KJiyqJWc2J1iIxOAHSmNEyAHKI353ZgMaZQG4ny1 JU+yzCCtO1QLxuQH43CvxXsKaPJSM4DxpZHh9rWSGz04YMCuq4ZdQN+ZzCKhpHu9yv AAniDr3nyH9eQXFAYDbiLLnP/gngImUYjUVo0A7u71h4mj9Sgz+ye7fPZNih6oi6o3 JoVb9axV76IKue0Hvs/zVesjl0NYVF08xgcwEn9pL7rAfQFtbkZZVs72XD1iGQ6TrW bS5QO96N53biw== From: Christian Brauner Date: Wed, 29 Oct 2025 13:20:51 +0100 Subject: [PATCH v4 38/72] selftests/namespaces: add listns() wrapper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251029-work-namespace-nstree-listns-v4-38-2e6f823ebdc0@kernel.org> References: <20251029-work-namespace-nstree-listns-v4-0-2e6f823ebdc0@kernel.org> In-Reply-To: <20251029-work-namespace-nstree-listns-v4-0-2e6f823ebdc0@kernel.org> To: linux-fsdevel@vger.kernel.org, Josef Bacik , Jeff Layton Cc: Jann Horn , Mike Yuan , =?utf-8?q?Zbigniew_J=C4=99drzejewski-Szmek?= , Lennart Poettering , Daan De Meyer , Aleksa Sarai , Amir Goldstein , Tejun Heo , Johannes Weiner , Thomas Gleixner , Alexander Viro , Jan Kara , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, bpf@vger.kernel.org, Eric Dumazet , Jakub Kicinski , netdev@vger.kernel.org, Arnd Bergmann , Christian Brauner X-Mailer: b4 0.15-dev-96507 X-Developer-Signature: v=1; a=openpgp-sha256; l=1405; i=brauner@kernel.org; h=from:subject:message-id; bh=WU3OpDiHSBOB5eonlPoaP8MJGbmszqupW5dQlbeASiQ=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWQysfVVdReE/1/FyLN48bEbkRMnXWbZf/ajzmV5y1t3v Uw5G7bZdZSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAExklTPDP2s15dW+nUo7fc+8 5VmatXTmF7eU1k9PnLMOLWVr3WO/ToGRYZLvxf+n1+UF/au6zbfzCb+6S4NNZua2v8/FVV4KTt0 TxAcA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Add a wrapper for the listns() system call. Signed-off-by: Christian Brauner --- tools/testing/selftests/namespaces/wrappers.h | 35 +++++++++++++++++++++++= ++++ 1 file changed, 35 insertions(+) diff --git a/tools/testing/selftests/namespaces/wrappers.h b/tools/testing/= selftests/namespaces/wrappers.h new file mode 100644 index 000000000000..9741a64a5b1d --- /dev/null +++ b/tools/testing/selftests/namespaces/wrappers.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include + +#ifndef __SELFTESTS_NAMESPACES_WRAPPERS_H__ +#define __SELFTESTS_NAMESPACES_WRAPPERS_H__ + +#ifndef __NR_listns + #if defined __alpha__ + #define __NR_listns 580 + #elif defined _MIPS_SIM + #if _MIPS_SIM =3D=3D _MIPS_SIM_ABI32 /* o32 */ + #define __NR_listns 4470 + #endif + #if _MIPS_SIM =3D=3D _MIPS_SIM_NABI32 /* n32 */ + #define __NR_listns 6470 + #endif + #if _MIPS_SIM =3D=3D _MIPS_SIM_ABI64 /* n64 */ + #define __NR_listns 5470 + #endif + #else + #define __NR_listns 470 + #endif +#endif + +static inline int sys_listns(const struct ns_id_req *req, __u64 *ns_ids, + size_t nr_ns_ids, unsigned int flags) +{ + return syscall(__NR_listns, req, ns_ids, nr_ns_ids, flags); +} + +#endif /* __SELFTESTS_NAMESPACES_WRAPPERS_H__ */ --=20 2.47.3