50
51 new_ns = clone_ipc_ns(ns);
52
53 put_ipc_ns(ns);
54 return new_ns;
55}
56
57
58
59
60
61
62
63
64
65void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
66 void (*free)(struct ipc_namespace *, struct kern_ipc_perm *))
67{
68 struct kern_ipc_perm *perm;
69 int next_id;
70 int total, in_use;
71
72 down_write(&ids->rw_mutex);
73
74 in_use = ids->in_use;
75
76 for (total = 0, next_id = 0; total < in_use; next_id++) {
77 perm = idr_find(&ids->ipcs_idr, next_id);
78 if (perm == NULL)
79 continue;
80 ipc_lock_by_ptr(perm);
81 free(ns, perm);
82 total++;
83 }
84 up_write(&ids->rw_mutex);
85}
86
87void free_ipc_ns(struct kref *kref)
88{
89 struct ipc_namespace *ns;
90