1 #ifndef __IPC_NAMESPACE_H__
2 #define __IPC_NAMESPACE_H__
6 #include <linux/rwsem.h>
7 #ifdef CONFIG_MEMORY_HOTPLUG
8 #include <linux/notifier.h>
9 #endif /* CONFIG_MEMORY_HOTPLUG */
12 * ipc namespace events
14 #define IPCNS_MEMCHANGED 0x00000001 /* Notify lowmem size changed */
16 #define IPCNS_CALLBACK_PRI 0
22 unsigned short seq_max;
23 struct rw_semaphore rw_mutex;
27 struct ipc_namespace {
29 struct ipc_ids ids[3];
45 #ifdef CONFIG_MEMORY_HOTPLUG
46 struct notifier_block ipcns_nb;
50 extern struct ipc_namespace init_ipc_ns;
51 extern atomic_t nr_ipc_ns;
54 #define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
56 #ifdef CONFIG_MEMORY_HOTPLUG
58 extern int register_ipcns_notifier(struct ipc_namespace *);
59 extern int unregister_ipcns_notifier(struct ipc_namespace *);
60 extern int ipcns_notify(unsigned long);
62 #else /* CONFIG_MEMORY_HOTPLUG */
64 static inline int register_ipcns_notifier(struct ipc_namespace *ipcns)
68 static inline int unregister_ipcns_notifier(struct ipc_namespace *ipcns)
72 static inline int ipcns_notify(unsigned long ev)
77 #endif /* CONFIG_MEMORY_HOTPLUG */
79 #else /* CONFIG_SYSVIPC */
80 #define INIT_IPC_NS(ns)
81 #endif /* CONFIG_SYSVIPC */
83 #if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS)
84 extern void free_ipc_ns(struct kref *kref);
85 extern struct ipc_namespace *copy_ipcs(unsigned long flags,
86 struct ipc_namespace *ns);
87 extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
88 void (*free)(struct ipc_namespace *,
89 struct kern_ipc_perm *));
91 static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
98 static inline void put_ipc_ns(struct ipc_namespace *ns)
100 kref_put(&ns->kref, free_ipc_ns);
103 static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
104 struct ipc_namespace *ns)
106 if (flags & CLONE_NEWIPC)
107 return ERR_PTR(-EINVAL);
112 static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
117 static inline void put_ipc_ns(struct ipc_namespace *ns)