All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@sw.ru>
To: Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] ipc namespace - compilation fix
Date: Tue, 13 Jun 2006 00:27:43 +0400	[thread overview]
Message-ID: <448DCE3F.8090905@sw.ru> (raw)

[-- 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_*

             reply	other threads:[~2006-06-12 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 20:27 Kirill Korotaev [this message]
2006-06-14  3:17 ` [PATCH] ipc namespace - compilation fix Horms

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=448DCE3F.8090905@sw.ru \
    --to=dev@sw.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.