public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipc namespace - compilation fix
@ 2006-06-12 20:27 Kirill Korotaev
  2006-06-14  3:17 ` Horms
  0 siblings, 1 reply; 2+ messages in thread
From: Kirill Korotaev @ 2006-06-12 20:27 UTC (permalink / raw)
  To: Andrew Morton, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

This patch fixes IPC namespace compilation when `make allnoconfig` is 
used. Checked all 3 possible combinations of config options.

Thanks,
Kirill

[-- Attachment #2: diff-ipc-ns-compilation --]
[-- Type: text/plain, Size: 2983 bytes --]

diff -uprN linux-2.6.16/include/linux/init_task.h linux-2.6.16-rc6-mm1/include/linux/init_task.h
--- linux-2.6.16/include/linux/init_task.h	2006-06-13 00:20:52.000000000 +0400
+++ linux-2.6.16-rc6-mm1/include/linux/init_task.h	2006-06-13 00:02:41.000000000 +0400
@@ -5,6 +5,7 @@
 #include <linux/rcupdate.h>
 #include <linux/utsname.h>
 #include <linux/interrupt.h>
+#include <linux/ipc.h>
 
 #define INIT_FDTABLE \
 {							\
@@ -73,8 +74,8 @@ 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,						\
+	INIT_IPC_NS(ipc_ns)						\
 }
 
 #define INIT_SIGHAND(sighand) {						\
diff -uprN linux-2.6.16/include/linux/ipc.h linux-2.6.16-rc6-mm1/include/linux/ipc.h
--- linux-2.6.16/include/linux/ipc.h	2006-06-13 00:20:52.000000000 +0400
+++ linux-2.6.16-rc6-mm1/include/linux/ipc.h	2006-06-13 00:04:41.000000000 +0400
@@ -88,20 +88,38 @@ struct ipc_namespace {
 };
 
 extern struct ipc_namespace init_ipc_ns;
+
+#ifdef CONFIG_SYSVIPC
+#define INIT_IPC_NS(ns)		.ns		= &init_ipc_ns,
+#else
+#define INIT_IPC_NS(ns)	
+#endif
+
+#ifdef CONFIG_IPC_NS
 extern void free_ipc_ns(struct kref *kref);
 extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
 extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
+#else
+static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
+{
+	return 0;
+}
+#endif
 
 static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
 {
+#ifdef CONFIG_IPC_NS
 	if (ns)
 		kref_get(&ns->kref);
+#endif
 	return ns;
 }
 
 static inline void put_ipc_ns(struct ipc_namespace *ns)
 {
+#ifdef CONFIG_IPC_NS
 	kref_put(&ns->kref, free_ipc_ns);
+#endif
 }
 
 #endif /* __KERNEL__ */
diff -uprN linux-2.6.16/ipc/util.c linux-2.6.16-rc6-mm1/ipc/util.c
--- linux-2.6.16/ipc/util.c	2006-06-13 00:21:04.000000000 +0400
+++ linux-2.6.16-rc6-mm1/ipc/util.c	2006-06-12 23:39:11.000000000 +0400
@@ -145,21 +145,6 @@ void free_ipc_ns(struct kref *kref)
 	shm_exit_ns(ns);
 	kfree(ns);
 }
-#else
-int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns)
-{
-	return -EINVAL;
-}
-
-int copy_ipcs(unsigned long flags, struct task_struct *tsk)
-{
-	return 0;
-}
-
-void free_ipc_ns(struct kref *kref)
-{
-	BUG(); /* init_ipc_ns should never be put */
-}
 #endif
 
 /**
diff -uprN linux-2.6.16/kernel/fork.c linux-2.6.16-rc6-mm1/kernel/fork.c
--- linux-2.6.16/kernel/fork.c	2006-06-13 00:20:52.000000000 +0400
+++ linux-2.6.16-rc6-mm1/kernel/fork.c	2006-06-12 23:51:16.000000000 +0400
@@ -1573,6 +1573,16 @@ static int unshare_semundo(unsigned long
 	return 0;
 }
 
+#ifndef CONFIG_IPC_NS
+static inline int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns)
+{
+	if (flags & CLONE_NEWIPC)
+		return -EINVAL;
+
+	return 0;
+}
+#endif
+
 /*
  * unshare allows a process to 'unshare' part of the process
  * context which was originally shared using clone.  copy_*

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipc namespace - compilation fix
  2006-06-12 20:27 [PATCH] ipc namespace - compilation fix Kirill Korotaev
@ 2006-06-14  3:17 ` Horms
  0 siblings, 0 replies; 2+ messages in thread
From: Horms @ 2006-06-14  3:17 UTC (permalink / raw)
  To: Kirill Korotaev; +Cc: Andrew Morton, Linux Kernel Mailing List

In article <448DCE3F.8090905@sw.ru> you wrote:
> Newsgroups: gmane.linux.kernel
> 
> [-- text/plain, encoding 7bit, charset: windows-1251, 6 lines --]
> 
> This patch fixes IPC namespace compilation when `make allnoconfig` is 
> used. Checked all 3 possible combinations of config options.

Hi, 

I can confirm that this patch resolves a compilation problem that
I was seeing in linux-2.6.17-rc6-mm2 on x86_64 with CONFIG_SYSVIPC
(and thus CONFIG_IPC_NS) unset.

CONFIG_SYSVIPC
CONFIG_IPC_NS

-- 
Horms                                           http://www.vergenet.net/~horms/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-14  3:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-12 20:27 [PATCH] ipc namespace - compilation fix Kirill Korotaev
2006-06-14  3:17 ` Horms

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox