From: Alejandro Colomar <alx@kernel.org>
To: Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org
Cc: Alejandro Colomar <alx@kernel.org>,
linux-api@vger.kernel.org, linux-man@vger.kernel.org,
Jan Kara <jack@suse.cz>,
Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [RFC v1] include/uapi/linux/sched.h: Add UNSHARE_* flags for consistency
Date: Tue, 1 Dec 2026 13:37:15 +0100 [thread overview]
Message-ID: <331f241755a20df4801e3545514c1dbdaaf908ba.1796128105.git.alx@kernel.org> (raw)
[-- 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 --]
reply other threads:[~2026-12-01 12:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=331f241755a20df4801e3545514c1dbdaaf908ba.1796128105.git.alx@kernel.org \
--to=alx@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox