[PATCH] build ipc/utils.c conditional on CONFIG_SYSVIPC

From: Christoph Hellwig
Date: Mon Feb 23 2004 - 09:26:36 EST


except for two tiny little stubs everything depends on CONFIG_SYSVIPC.
Thus move the stubs to the proper place (sem.h) and get rid of the
ifdefs in that file.

Also fix up fork.c to use sem.h insted of it's own externs.


--- 1.8/include/linux/sem.h Sat Jul 5 08:52:29 2003
+++ edited/include/linux/sem.h Mon Feb 23 13:39:22 2004
@@ -140,8 +140,18 @@
asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
unsigned nsops, const struct timespec __user *timeout);

+#ifdef CONFIG_SYSVIPC
+int copy_semundo(unsigned long clone_flags, struct task_struct *p);
void exit_sem(struct task_struct *p);
+#else
+static inline void exit_sem(struct task_struct *p)
+{
+}
+static inline int copy_semundo(unsigned long clone_flags, struct task_struct *p)
+{
+ return 0;
+}

+#endif /* CONFIG_SYSVIPC */
#endif /* __KERNEL__ */
-
#endif /* _LINUX_SEM_H */
--- 1.3/ipc/Makefile Sat Dec 14 13:38:56 2002
+++ edited/ipc/Makefile Mon Feb 23 13:40:45 2004
@@ -2,6 +2,4 @@
# Makefile for the linux ipc.
#

-obj-y := util.o
-
-obj-$(CONFIG_SYSVIPC) += msg.o sem.o shm.o
+obj-$(CONFIG_SYSVIPC) += util.o msg.o sem.o shm.o
--- 1.16/ipc/util.c Mon Feb 23 06:24:11 2004
+++ edited/ipc/util.c Mon Feb 23 13:40:30 2004
@@ -12,7 +12,6 @@
* Mingming Cao <cmm@xxxxxxxxxx>
*/

-#include <linux/config.h>
#include <linux/mm.h>
#include <linux/shm.h>
#include <linux/init.h>
@@ -25,8 +24,6 @@
#include <linux/rcupdate.h>
#include <linux/workqueue.h>

-#if defined(CONFIG_SYSVIPC)
-
#include "util.h"

/**
@@ -531,20 +528,3 @@
}

#endif /* __ia64__ */
-
-#else
-/*
- * Dummy functions when SYSV IPC isn't configured
- */
-
-int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
-{
- return 0;
-}
-
-void exit_sem(struct task_struct *tsk)
-{
- return;
-}
-
-#endif /* CONFIG_SYSVIPC */
--- 1.156/kernel/fork.c Thu Feb 19 04:42:38 2004
+++ edited/kernel/fork.c Mon Feb 23 13:39:31 2004
@@ -30,6 +30,7 @@
#include <linux/futex.h>
#include <linux/ptrace.h>
#include <linux/mount.h>
+#include <linux/sem.h>

#include <asm/pgtable.h>
#include <asm/pgalloc.h>
@@ -37,9 +38,6 @@
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
-
-extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
-extern void exit_sem(struct task_struct *tsk);

/* The idle threads do not count..
* Protected by write_lock_irq(&tasklist_lock)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/