Skip to contentSkip to conversation

build ipc/utils.c conditional on CONFIG_SYSVIPC

PATCH New Christoph Hellwig 1 participant 1 message Feb 23, 2004

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

PATCH 1/1 build ipc/utils.c conditional on CONFIG_SYSVIPC

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.

include/linux/sem.h +11 -1
@@ -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 */
ipc/Makefile +1 -3
@@ -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 
ipc/util.c +0 -20
@@ -12,7 +12,6 @@
  *            Mingming Cao <[email protected]>
  */
 
-#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 */
kernel/fork.c +1 -3
@@ -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)