Add namespace contexts
Add a context for each available kernel namespace which currently are :
cgroup, ipc, mnt, net, pid, user and uts. The id chosen to identify the
namespaces is the inode number of the file representing each one of them
in the proc filesystem. This was instroduced in v3.8.0 in this commit :
commit
98f842e675f96ffac96e6c50315790912b2812be
Author: Eric W. Biederman <ebiederm@xmission.com>
Date: Wed Jun 15 10:21:48 2011 -0700
proc: Usable inode numbers for the namespace file descriptors.
Assign a unique proc inode to each namespace, and use that
inode number to ensure we only allocate at most one proc
inode for every namespace in proc.
A single proc inode per namespace allows userspace to test
to see if two processes are in the same namespace.
...
Prior to this there is no unique identifier for a namespace that is
available to both the kernel and userspace. Enabling any of these
contexts on a kernel that is too old or doesn't have the proper features
enabled will fail and return -ENOSYS.
Per namespace particularities :
- Cgroup
- Introduced in 4.6.0
- CONFIG_CGROUPS
- IPC
- Introduced in 2.6.25
- CONFIG_IPC_NS
- MNT
- Introduced in 2.6.20
- The mnt_namespace struct is defined in a private header
- NET
- Introduced in 2.6.24
- CONFIG_NET_NS
- PID
- Introduced in 2.6.20
- CONFIG_PID_NS
- User
- Introduced in 2.6.23
- CONFIG_USER_NS
- UTS
- Introduced in 2.6.19
- CONFIG_UTS_NS
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>