xref: /linux-6.15/include/uapi/linux/nsfs.h (revision 42b0f8da)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
26786741dSAndrey Vagin #ifndef __LINUX_NSFS_H
36786741dSAndrey Vagin #define __LINUX_NSFS_H
46786741dSAndrey Vagin 
56786741dSAndrey Vagin #include <linux/ioctl.h>
6*42b0f8daSChristian Brauner #include <linux/types.h>
76786741dSAndrey Vagin 
86786741dSAndrey Vagin #define NSIO	0xb7
96786741dSAndrey Vagin 
106786741dSAndrey Vagin /* Returns a file descriptor that refers to an owning user namespace */
116786741dSAndrey Vagin #define NS_GET_USERNS		_IO(NSIO, 0x1)
12a7306ed8SAndrey Vagin /* Returns a file descriptor that refers to a parent namespace */
13a7306ed8SAndrey Vagin #define NS_GET_PARENT		_IO(NSIO, 0x2)
14e5ff5ce6SMichael Kerrisk (man-pages) /* Returns the type of namespace (CLONE_NEW* value) referred to by
15e5ff5ce6SMichael Kerrisk (man-pages)    file descriptor */
16e5ff5ce6SMichael Kerrisk (man-pages) #define NS_GET_NSTYPE		_IO(NSIO, 0x3)
17d95fa3c7SMichael Kerrisk (man-pages) /* Get owner UID (in the caller's user namespace) for a user namespace */
18d95fa3c7SMichael Kerrisk (man-pages) #define NS_GET_OWNER_UID	_IO(NSIO, 0x4)
19e8e43a1fSJosef Bacik /* Get the id for a mount namespace */
20*42b0f8daSChristian Brauner #define NS_GET_MNTNS_ID		_IOR(NSIO, 0x5, __u64)
21ca567df7SChristian Brauner /* Translate pid from target pid namespace into the caller's pid namespace. */
221b074abeSLinus Torvalds #define NS_GET_PID_FROM_PIDNS	_IOR(NSIO, 0x6, int)
23ca567df7SChristian Brauner /* Return thread-group leader id of pid in the callers pid namespace. */
24ca567df7SChristian Brauner #define NS_GET_TGID_FROM_PIDNS	_IOR(NSIO, 0x7, int)
25ca567df7SChristian Brauner /* Translate pid from caller's pid namespace into a target pid namespace. */
261b074abeSLinus Torvalds #define NS_GET_PID_IN_PIDNS	_IOR(NSIO, 0x8, int)
27ca567df7SChristian Brauner /* Return thread-group leader id of pid in the target pid namespace. */
281b074abeSLinus Torvalds #define NS_GET_TGID_IN_PIDNS	_IOR(NSIO, 0x9, int)
296786741dSAndrey Vagin 
306786741dSAndrey Vagin struct mnt_ns_info {
31 	__u32 size;
32 	__u32 nr_mounts;
33 	__u64 mnt_ns_id;
34 };
35 
36 #define MNT_NS_INFO_SIZE_VER0 16 /* size of first published struct */
37 
38 /* Get information about namespace. */
39 #define NS_MNT_GET_INFO		_IOR(NSIO, 10, struct mnt_ns_info)
40 /* Get next namespace. */
41 #define NS_MNT_GET_NEXT		_IOR(NSIO, 11, struct mnt_ns_info)
42 /* Get previous namespace. */
43 #define NS_MNT_GET_PREV		_IOR(NSIO, 12, struct mnt_ns_info)
44 
45 #endif /* __LINUX_NSFS_H */
46