Skip to contentSkip to conversation

ipc namespace - compilation fix

PATCH In review Kirill Korotaev 2 participants 2 messages Jun 12, 2006 – Jun 14, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc namespace - compilation fix

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

Thanks,
Kirill

include/linux/init_task.h +2 -1
diff -uprN linux-2.6.16/include/linux/init_task.h linux-2.6.16-rc6-mm1/include/linux/init_task.h
@@ -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) {						\
include/linux/ipc.h +18 -0
diff -uprN linux-2.6.16/include/linux/ipc.h linux-2.6.16-rc6-mm1/include/linux/ipc.h
@@ -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__ */
ipc/util.c +0 -15
diff -uprN linux-2.6.16/ipc/util.c linux-2.6.16-rc6-mm1/ipc/util.c
@@ -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
 
 /**
kernel/fork.c +10 -0
diff -uprN linux-2.6.16/kernel/fork.c linux-2.6.16-rc6-mm1/kernel/fork.c
@@ -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_*
#1 lore raw
Quoted 6 lines · In article <[email protected]> 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

Signature · 1 line
Horms                                           http://www.vergenet.net/~horms/