diff options
author | Kirill Korotaev <dev@openvz.org> | 2006-10-02 05:18:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:22 -0400 |
commit | 73ea41302bab5e02c9e86ab15c509494a550f1db (patch) | |
tree | 10971a839dd53a9e18d6c866c9be93517fe8de25 /ipc/util.h | |
parent | 25b21cb2f6d69b0475b134e0a3e8e269137270fa (diff) |
[PATCH] IPC namespace - utils
This patch adds basic IPC namespace functionality to
IPC utils:
- init_ipc_ns
- copy/clone/unshare/free IPC ns
- /proc preparations
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'ipc/util.h')
-rw-r--r-- | ipc/util.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/ipc/util.h b/ipc/util.h index 0181553d31d..c8fd6b9d77b 100644 --- a/ipc/util.h +++ b/ipc/util.h | |||
@@ -3,6 +3,8 @@ | |||
3 | * Copyright (C) 1999 Christoph Rohland | 3 | * Copyright (C) 1999 Christoph Rohland |
4 | * | 4 | * |
5 | * ipc helper functions (c) 1999 Manfred Spraul <manfred@colorfullife.com> | 5 | * ipc helper functions (c) 1999 Manfred Spraul <manfred@colorfullife.com> |
6 | * namespaces support. 2006 OpenVZ, SWsoft Inc. | ||
7 | * Pavel Emelianov <xemul@openvz.org> | ||
6 | */ | 8 | */ |
7 | 9 | ||
8 | #ifndef _IPC_UTIL_H | 10 | #ifndef _IPC_UTIL_H |
@@ -15,6 +17,14 @@ void sem_init (void); | |||
15 | void msg_init (void); | 17 | void msg_init (void); |
16 | void shm_init (void); | 18 | void shm_init (void); |
17 | 19 | ||
20 | int sem_init_ns(struct ipc_namespace *ns); | ||
21 | int msg_init_ns(struct ipc_namespace *ns); | ||
22 | int shm_init_ns(struct ipc_namespace *ns); | ||
23 | |||
24 | void sem_exit_ns(struct ipc_namespace *ns); | ||
25 | void msg_exit_ns(struct ipc_namespace *ns); | ||
26 | void shm_exit_ns(struct ipc_namespace *ns); | ||
27 | |||
18 | struct ipc_id_ary { | 28 | struct ipc_id_ary { |
19 | int size; | 29 | int size; |
20 | struct kern_ipc_perm *p[0]; | 30 | struct kern_ipc_perm *p[0]; |
@@ -31,15 +41,23 @@ struct ipc_ids { | |||
31 | }; | 41 | }; |
32 | 42 | ||
33 | struct seq_file; | 43 | struct seq_file; |
34 | void __init ipc_init_ids(struct ipc_ids* ids, int size); | 44 | #ifdef CONFIG_IPC_NS |
45 | #define __ipc_init | ||
46 | #else | ||
47 | #define __ipc_init __init | ||
48 | #endif | ||
49 | void __ipc_init ipc_init_ids(struct ipc_ids *ids, int size); | ||
35 | #ifdef CONFIG_PROC_FS | 50 | #ifdef CONFIG_PROC_FS |
36 | void __init ipc_init_proc_interface(const char *path, const char *header, | 51 | void __init ipc_init_proc_interface(const char *path, const char *header, |
37 | struct ipc_ids *ids, | 52 | int ids, int (*show)(struct seq_file *, void *)); |
38 | int (*show)(struct seq_file *, void *)); | ||
39 | #else | 53 | #else |
40 | #define ipc_init_proc_interface(path, header, ids, show) do {} while (0) | 54 | #define ipc_init_proc_interface(path, header, ids, show) do {} while (0) |
41 | #endif | 55 | #endif |
42 | 56 | ||
57 | #define IPC_SEM_IDS 0 | ||
58 | #define IPC_MSG_IDS 1 | ||
59 | #define IPC_SHM_IDS 2 | ||
60 | |||
43 | /* must be called with ids->mutex acquired.*/ | 61 | /* must be called with ids->mutex acquired.*/ |
44 | int ipc_findkey(struct ipc_ids* ids, key_t key); | 62 | int ipc_findkey(struct ipc_ids* ids, key_t key); |
45 | int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size); | 63 | int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size); |