Re: [PATCH 1/6] IPC namespace core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kirill Korotaev wrote:
> This patch implements core IPC namespace changes:
> - ipc_namespace structure
> - new config option CONFIG_IPC_NS
> - adds CLONE_NEWIPC flag
> - unshare support
> 
> Signed-Off-By: Pavel Emelianov <[email protected]>
> Signed-Off-By: Kirill Korotaev <[email protected]>
> 
> 
> ------------------------------------------------------------------------
> 
> --- ./include/linux/init_task.h.ipcns	2006-06-06 14:47:58.000000000 +0400
> +++ ./include/linux/init_task.h	2006-06-08 14:28:23.000000000 +0400
> @@ -73,6 +73,7 @@ extern struct nsproxy init_nsproxy;
>  	.count		= ATOMIC_INIT(1),				\
>  	.nslock		= SPIN_LOCK_UNLOCKED,				\
>  	.uts_ns		= &init_uts_ns,					\
> +	.ipc_ns		= &init_ipc_ns,					\
>  	.namespace	= NULL,						\
>  }
>  
> --- ./include/linux/ipc.h.ipcns	2006-04-21 11:59:36.000000000 +0400
> +++ ./include/linux/ipc.h	2006-06-08 15:43:43.000000000 +0400
> @@ -2,6 +2,7 @@
>  #define _LINUX_IPC_H
>  
>  #include <linux/types.h>
> +#include <linux/kref.h>
>  
>  #define IPC_PRIVATE ((__kernel_key_t) 0)  
>  
> @@ -68,6 +69,41 @@ struct kern_ipc_perm
>  	void		*security;
>  };
>  
> +struct ipc_ids;
> +struct ipc_namespace {
> +	struct kref	kref;
> +	struct ipc_ids	*ids[3];
> +
> +	int		sem_ctls[4];
> +	int		used_sems;
> +
> +	int		msg_ctlmax;
> +	int		msg_ctlmnb;
> +	int		msg_ctlmni;
> +
> +	size_t		shm_ctlmax;
> +	size_t		shm_ctlall;
> +	int		shm_ctlmni;
> +	int		shm_tot;
> +};

you could probably simplify your patch by moving struct ipc_ids to ipc.h
and not allocating ids.

see patch bellow. I've been working all week on this patchset :)

C.



From: Cedric Le Goater <[email protected]>
Subject: namespaces sysvipc : move struct ipc_ids to ipc.h  

Signed-off-by: Cedric Le Goater <[email protected]>

---
 include/linux/ipc.h |   17 +++++++++++++++++
 ipc/util.h          |   15 ---------------
 2 files changed, 17 insertions(+), 15 deletions(-)

Index: 2.6.17-rc5-mm3/include/linux/ipc.h
===================================================================
--- 2.6.17-rc5-mm3.orig/include/linux/ipc.h
+++ 2.6.17-rc5-mm3/include/linux/ipc.h
@@ -51,6 +51,8 @@ struct ipc_perm
 
 #ifdef __KERNEL__
 
+#include <linux/mutex.h>
+
 #define IPCMNI 32768  /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
 
 /* used by in-kernel data structures */
@@ -68,6 +70,21 @@ struct kern_ipc_perm
 	void		*security;
 };
 
+struct ipc_id_ary {
+	int size;
+	struct kern_ipc_perm *p[0];
+};
+
+struct ipc_ids {
+	int in_use;
+	int max_id;
+	unsigned short seq;
+	unsigned short seq_max;
+	struct mutex mutex;
+	struct ipc_id_ary nullentry;
+	struct ipc_id_ary* entries;
+};
+
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_IPC_H */
Index: 2.6.17-rc5-mm3/ipc/util.h
===================================================================
--- 2.6.17-rc5-mm3.orig/ipc/util.h
+++ 2.6.17-rc5-mm3/ipc/util.h
@@ -15,21 +15,6 @@ void sem_init (void);
 void msg_init (void);
 void shm_init (void);
 
-struct ipc_id_ary {
-	int size;
-	struct kern_ipc_perm *p[0];
-};
-
-struct ipc_ids {
-	int in_use;
-	int max_id;
-	unsigned short seq;
-	unsigned short seq_max;
-	struct mutex mutex;
-	struct ipc_id_ary nullentry;
-	struct ipc_id_ary* entries;
-};
-
 struct seq_file;
 void __init ipc_init_ids(struct ipc_ids* ids, int size);
 #ifdef CONFIG_PROC_FS

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux