* [RFC v1] include/uapi/linux/sched.h: Add UNSHARE_* flags for consistency
@ 2026-12-01 12:37 Alejandro Colomar
0 siblings, 0 replies; only message in thread
From: Alejandro Colomar @ 2026-12-01 12:37 UTC (permalink / raw)
To: Christian Brauner, linux-fsdevel
Cc: Alejandro Colomar, linux-api, linux-man, Jan Kara, Alexander Viro
[-- Attachment #1: Type: text/plain, Size: 2534 bytes --]
These are just aliases for the same bits from CLONE_* flags (except for
UNSHARE_EMPTY_MNTNS), but they make unshare(2) read consistently, and
make it easier to document.
User-space doesn't need to worry about implementation-details concerning
bits shared between system calls.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
Hi!
This patch only adds the macros, and doesn't change the implementation
of unshare(2), which remains compatible with the old flags, to reduce
churn.
I've only added UNSHARE_* flags for those CLONE_* flags that are
documented in the unshare(2) manual page to have some effect. If there
are missing flags that have effects, we should also add them, and also
document them as having effect for unshare(2).
Cheers,
Alex
include/uapi/linux/sched.h | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h
index 19ffeba89428..22cf9e26a0bc 100644
--- a/include/uapi/linux/sched.h
+++ b/include/uapi/linux/sched.h
@@ -42,16 +42,24 @@
#define CLONE_EMPTY_MNTNS (1ULL << 37) /* Create an empty mount namespace. */
/*
- * cloning flags intersect with CSIGNAL so can be used with unshare and clone3
+ * cloning flags intersect with CSIGNAL so can be used with clone3
* syscalls only:
*/
#define CLONE_NEWTIME 0x00000080 /* New time namespace */
-/*
- * unshare flags share the bit space with clone flags but only apply to the
- * unshare syscall:
- */
-#define UNSHARE_EMPTY_MNTNS 0x00100000 /* Unshare an empty mount namespace. */
+/* Flags for the unshare() syscall. */
+#define UNSHARE_NEWTIME 0x00000080 /* New time namespace for children */
+#define UNSHARE_FS 0x00000200 /* Reverse effect of CLONE_FS */
+#define UNSHARE_FILES 0x00000400 /* Reverse effect of CLONE_FILES */
+#define UNSHARE_NEWNS 0x00020000 /* New mount namespace group */
+#define UNSHARE_SYSVSEM 0x00040000 /* Reverse effect of CLONE_SYSVSEM */
+#define UNSHARE_EMPTY_MNTNS 0x00100000 /* Unshare an empty mount namespace */
+#define UNSHARE_NEWCGROUP 0x02000000 /* New cgroup namespace */
+#define UNSHARE_NEWUTS 0x04000000 /* New utsname namespace */
+#define UNSHARE_NEWIPC 0x08000000 /* New ipc namespace */
+#define UNSHARE_NEWUSER 0x10000000 /* New user namespace */
+#define UNSHARE_NEWPID 0x20000000 /* New pid namespace */
+#define UNSHARE_NEWNET 0x40000000 /* New network namespace */
#ifndef __ASSEMBLER__
/**
--
2.55.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 12:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 12:37 [RFC v1] include/uapi/linux/sched.h: Add UNSHARE_* flags for consistency Alejandro Colomar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox