cgroup: introduce cgroup namespaces
Introduce the ability to create new cgroup namespace. The newly created cgroup namespace remembers the cgroup of the process at the point of creation of the cgroup namespace (referred as cgroupns-root). The main purpose of cgroup namespace is to virtualize the contents of /proc/self/cgroup file. Processes inside a cgroup namespace are only able to see paths relative to their namespace root (unless they are moved outside of their cgroupns-root, at which point they will see a relative path from their cgroupns-root). For a correctly setup container this enables container-tools (like libcontainer, lxc, lmctfy, etc.) to create completely virtualized containers without leaking system level cgroup hierarchy to the task. This patch only implements the 'unshare' part of the cgroupns. Signed-off-by: Aditya Kali <adityakali@google.com> Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
struct pid_namespace;
|
||||
struct nsproxy;
|
||||
struct path;
|
||||
struct task_struct;
|
||||
struct inode;
|
||||
|
||||
struct proc_ns_operations {
|
||||
const char *name;
|
||||
@@ -24,6 +26,7 @@ extern const struct proc_ns_operations ipcns_operations;
|
||||
extern const struct proc_ns_operations pidns_operations;
|
||||
extern const struct proc_ns_operations userns_operations;
|
||||
extern const struct proc_ns_operations mntns_operations;
|
||||
extern const struct proc_ns_operations cgroupns_operations;
|
||||
|
||||
/*
|
||||
* We always define these enumerators
|
||||
@@ -34,6 +37,7 @@ enum {
|
||||
PROC_UTS_INIT_INO = 0xEFFFFFFEU,
|
||||
PROC_USER_INIT_INO = 0xEFFFFFFDU,
|
||||
PROC_PID_INIT_INO = 0xEFFFFFFCU,
|
||||
PROC_CGROUP_INIT_INO = 0xEFFFFFFBU,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
Reference in New Issue
Block a user