diff options
Diffstat (limited to 'include/linux/ipc.h')
-rw-r--r-- | include/linux/ipc.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/linux/ipc.h b/include/linux/ipc.h index b291189737e7..636094c29b16 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h | |||
@@ -51,6 +51,8 @@ struct ipc_perm | |||
51 | 51 | ||
52 | #ifdef __KERNEL__ | 52 | #ifdef __KERNEL__ |
53 | 53 | ||
54 | #include <linux/kref.h> | ||
55 | |||
54 | #define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ | 56 | #define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ |
55 | 57 | ||
56 | /* used by in-kernel data structures */ | 58 | /* used by in-kernel data structures */ |
@@ -68,6 +70,59 @@ struct kern_ipc_perm | |||
68 | void *security; | 70 | void *security; |
69 | }; | 71 | }; |
70 | 72 | ||
73 | struct ipc_ids; | ||
74 | struct ipc_namespace { | ||
75 | struct kref kref; | ||
76 | struct ipc_ids *ids[3]; | ||
77 | |||
78 | int sem_ctls[4]; | ||
79 | int used_sems; | ||
80 | |||
81 | int msg_ctlmax; | ||
82 | int msg_ctlmnb; | ||
83 | int msg_ctlmni; | ||
84 | |||
85 | size_t shm_ctlmax; | ||
86 | size_t shm_ctlall; | ||
87 | int shm_ctlmni; | ||
88 | int shm_tot; | ||
89 | }; | ||
90 | |||
91 | extern struct ipc_namespace init_ipc_ns; | ||
92 | |||
93 | #ifdef CONFIG_SYSVIPC | ||
94 | #define INIT_IPC_NS(ns) .ns = &init_ipc_ns, | ||
95 | #else | ||
96 | #define INIT_IPC_NS(ns) | ||
97 | #endif | ||
98 | |||
99 | #ifdef CONFIG_IPC_NS | ||
100 | extern void free_ipc_ns(struct kref *kref); | ||
101 | extern int copy_ipcs(unsigned long flags, struct task_struct *tsk); | ||
102 | extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns); | ||
103 | #else | ||
104 | static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk) | ||
105 | { | ||
106 | return 0; | ||
107 | } | ||
108 | #endif | ||
109 | |||
110 | static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) | ||
111 | { | ||
112 | #ifdef CONFIG_IPC_NS | ||
113 | if (ns) | ||
114 | kref_get(&ns->kref); | ||
115 | #endif | ||
116 | return ns; | ||
117 | } | ||
118 | |||
119 | static inline void put_ipc_ns(struct ipc_namespace *ns) | ||
120 | { | ||
121 | #ifdef CONFIG_IPC_NS | ||
122 | kref_put(&ns->kref, free_ipc_ns); | ||
123 | #endif | ||
124 | } | ||
125 | |||
71 | #endif /* __KERNEL__ */ | 126 | #endif /* __KERNEL__ */ |
72 | 127 | ||
73 | #endif /* _LINUX_IPC_H */ | 128 | #endif /* _LINUX_IPC_H */ |