[LTP] [PATCH 2/5] Add listns fallback header

Andrea Cervesato andrea.cervesato@suse.de
Fri Mar 13 12:07:28 CET 2026


From: Andrea Cervesato <andrea.cervesato@suse.com>

Create include/lapi/listns.h header file for listns syscall related
definitions.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 include/lapi/listns.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/include/lapi/listns.h b/include/lapi/listns.h
new file mode 100644
index 0000000000000000000000000000000000000000..d242d3340ee4286fb8621b1633061c8087c54e7c
--- /dev/null
+++ b/include/lapi/listns.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2025 Linux Test Project
+ */
+
+#ifndef LAPI_LISTNS_H__
+#define LAPI_LISTNS_H__
+
+#include <stdint.h>
+#include "lapi/syscalls.h"
+#include "lapi/sched.h"
+
+#ifndef NS_ID_REQ_SIZE_VER0
+#define NS_ID_REQ_SIZE_VER0 32
+#endif
+
+#ifndef LISTNS_CURRENT_USER
+#define LISTNS_CURRENT_USER 0xffffffffffffffffULL
+#endif
+
+struct listns_req {
+	uint32_t size;
+	uint32_t spare;
+	uint64_t ns_id;
+	uint32_t ns_type;
+	uint32_t spare2;
+	uint64_t user_ns_id;
+};
+
+static inline int listns(struct listns_req *req, uint64_t *ns_ids,
+			 size_t nr_ns_ids, unsigned int flags)
+{
+	return tst_syscall(__NR_listns, req, ns_ids, nr_ns_ids, flags);
+}
+
+#endif /* LAPI_LISTNS_H__ */

-- 
2.51.0



More information about the ltp mailing list