Lines Matching defs:ns

28 static struct ucounts *inc_ipc_namespaces(struct user_namespace *ns)
30 return inc_ucount(ns, current_euid(), UCOUNT_IPC_NAMESPACES);
41 struct ipc_namespace *ns;
60 ns = kzalloc(sizeof(struct ipc_namespace), GFP_KERNEL_ACCOUNT);
61 if (ns == NULL)
64 err = ns_alloc_inum(&ns->ns);
67 ns->ns.ops = &ipcns_operations;
69 refcount_set(&ns->ns.count, 1);
70 ns->user_ns = get_user_ns(user_ns);
71 ns->ucounts = ucounts;
73 err = mq_init_ns(ns);
78 if (!setup_mq_sysctls(ns))
81 if (!setup_ipc_sysctls(ns))
84 err = msg_init_ns(ns);
88 sem_init_ns(ns);
89 shm_init_ns(ns);
91 return ns;
94 retire_mq_sysctls(ns);
97 put_user_ns(ns->user_ns);
98 ns_free_inum(&ns->ns);
100 kfree(ns);
108 struct user_namespace *user_ns, struct ipc_namespace *ns)
111 return get_ipc_ns(ns);
112 return create_ipc_ns(user_ns, ns);
117 * @ns: the namespace to remove the ipcs from
123 void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
140 free(ns, perm);
146 static void free_ipc_ns(struct ipc_namespace *ns)
152 mntput(ns->mq_mnt);
153 sem_exit_ns(ns);
154 msg_exit_ns(ns);
155 shm_exit_ns(ns);
157 retire_mq_sysctls(ns);
158 retire_ipc_sysctls(ns);
160 dec_ipc_namespaces(ns->ucounts);
161 put_user_ns(ns->user_ns);
162 ns_free_inum(&ns->ns);
163 kfree(ns);
184 * @ns: the namespace to put
198 void put_ipc_ns(struct ipc_namespace *ns)
200 if (refcount_dec_and_lock(&ns->ns.count, &mq_lock)) {
201 mq_clear_sbinfo(ns);
204 if (llist_add(&ns->mnt_llist, &free_ipc_list))
209 static inline struct ipc_namespace *to_ipc_ns(struct ns_common *ns)
211 return container_of(ns, struct ipc_namespace, ns);
216 struct ipc_namespace *ns = NULL;
222 ns = get_ipc_ns(nsproxy->ipc_ns);
225 return ns ? &ns->ns : NULL;
228 static void ipcns_put(struct ns_common *ns)
230 return put_ipc_ns(to_ipc_ns(ns));
236 struct ipc_namespace *ns = to_ipc_ns(new);
237 if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) ||
242 nsproxy->ipc_ns = get_ipc_ns(ns);
246 static struct user_namespace *ipcns_owner(struct ns_common *ns)
248 return to_ipc_ns(ns)->user_ns;