X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ipc%2Futil.c;h=44e5135aee4785e2da26de92e0d3b52b02246842;hb=566cfd8f0e049a0647f94714f913e2a975dc464f;hp=0b652387d169a6b6af1609071bfb3aa2e8a6b954;hpb=445c9b5507b9d09a2e9b0b4dbb16517708aa40e6;p=pandora-kernel.git diff --git a/ipc/util.c b/ipc/util.c index 0b652387d169..44e5135aee47 100644 --- a/ipc/util.c +++ b/ipc/util.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -51,7 +50,6 @@ struct ipc_namespace init_ipc_ns = { }, }; -#ifdef CONFIG_IPC_NS static struct ipc_namespace *clone_ipc_ns(struct ipc_namespace *old_ns) { int err; @@ -85,53 +83,20 @@ err_mem: return ERR_PTR(err); } -int unshare_ipcs(unsigned long unshare_flags, struct ipc_namespace **new_ipc) +struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns) { - struct ipc_namespace *new; - - if (unshare_flags & CLONE_NEWIPC) { - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - - new = clone_ipc_ns(current->nsproxy->ipc_ns); - if (IS_ERR(new)) - return PTR_ERR(new); - - *new_ipc = new; - } - - return 0; -} - -int copy_ipcs(unsigned long flags, struct task_struct *tsk) -{ - struct ipc_namespace *old_ns = tsk->nsproxy->ipc_ns; struct ipc_namespace *new_ns; - int err = 0; - - if (!old_ns) - return 0; - get_ipc_ns(old_ns); + BUG_ON(!ns); + get_ipc_ns(ns); if (!(flags & CLONE_NEWIPC)) - return 0; + return ns; - if (!capable(CAP_SYS_ADMIN)) { - err = -EPERM; - goto out; - } - - new_ns = clone_ipc_ns(old_ns); - if (!new_ns) { - err = -ENOMEM; - goto out; - } + new_ns = clone_ipc_ns(ns); - tsk->nsproxy->ipc_ns = new_ns; -out: - put_ipc_ns(old_ns); - return err; + put_ipc_ns(ns); + return new_ns; } void free_ipc_ns(struct kref *kref) @@ -144,14 +109,6 @@ void free_ipc_ns(struct kref *kref) shm_exit_ns(ns); kfree(ns); } -#else -int copy_ipcs(unsigned long flags, struct task_struct *tsk) -{ - if (flags & CLONE_NEWIPC) - return -EINVAL; - return 0; -} -#endif /** * ipc_init - initialise IPC subsystem @@ -179,7 +136,7 @@ __initcall(ipc_init); * array itself. */ -void __ipc_init ipc_init_ids(struct ipc_ids* ids, int size) +void ipc_init_ids(struct ipc_ids* ids, int size) { int i;