From: Christopher Hoover Not everyone needs futex support, so it should be optional. This is needed for small platforms. include/linux/futex.h | 2 ++ init/Kconfig | 20 ++++++++++++++++++-- kernel/Makefile | 3 ++- kernel/compat.c | 5 +++-- kernel/sys.c | 2 ++ 5 files changed, 27 insertions(+), 5 deletions(-) diff -puN init/Kconfig~CONFIG_FUTEX init/Kconfig --- 25/init/Kconfig~CONFIG_FUTEX 2003-05-16 22:48:43.000000000 -0700 +++ 25-akpm/init/Kconfig 2003-05-17 01:54:08.000000000 -0700 @@ -108,7 +108,24 @@ config LOG_BUF_SHIFT 13 => 8 KB 12 => 4 KB -endmenu + +menuconfig EMBEDDED + bool "Remove kernel features (for embedded systems)" + help + This option allows certain base kernel features to be removed from + the build. This is for specialized environments which can tolerate + a "non-standard" kernel. Only use this if you really know what you + are doing. + +config FUTEX + bool "Enable futex support" if EMBEDDED + default y + help + Disabling this option will cause the kernel to be built without + support for "fast userspace mutexes". The resulting kernel may not + run glibc-based applications correctly. + +endmenu # General setup menu "Loadable module support" @@ -181,4 +198,3 @@ config KMOD in . endmenu - diff -puN kernel/Makefile~CONFIG_FUTEX kernel/Makefile --- 25/kernel/Makefile~CONFIG_FUTEX 2003-05-16 22:48:43.000000000 -0700 +++ 25-akpm/kernel/Makefile 2003-05-16 22:48:43.000000000 -0700 @@ -5,9 +5,10 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \ exit.o itimer.o time.o softirq.o resource.o \ sysctl.o capability.o ptrace.o timer.o user.o \ - signal.o sys.o kmod.o workqueue.o futex.o pid.o \ + signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o intermodule.o extable.o params.o posix-timers.o +obj-$(CONFIG_FUTEX) += futex.o obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o obj-$(CONFIG_SMP) += cpu.o obj-$(CONFIG_LOCKMETER) += lockmeter.o diff -puN kernel/sys.c~CONFIG_FUTEX kernel/sys.c --- 25/kernel/sys.c~CONFIG_FUTEX 2003-05-16 22:48:43.000000000 -0700 +++ 25-akpm/kernel/sys.c 2003-05-17 01:51:01.000000000 -0700 @@ -228,6 +228,8 @@ cond_syscall(sys_shutdown) cond_syscall(sys_sendmsg) cond_syscall(sys_recvmsg) cond_syscall(sys_socketcall) +cond_syscall(sys_futex) +cond_syscall(compat_sys_futex) static int set_one_prio(struct task_struct *p, int niceval, int error) { diff -puN kernel/compat.c~CONFIG_FUTEX kernel/compat.c --- 25/kernel/compat.c~CONFIG_FUTEX 2003-05-16 22:48:43.000000000 -0700 +++ 25-akpm/kernel/compat.c 2003-05-16 22:48:43.000000000 -0700 @@ -18,6 +18,7 @@ #include #include /* for MAX_SCHEDULE_TIMEOUT */ #include /* for FUTEX_WAIT */ +#include #include @@ -211,8 +212,7 @@ asmlinkage long compat_sys_sigprocmask(i return ret; } -extern long do_futex(unsigned long, int, int, unsigned long); - +#ifdef CONFIG_FUTEX asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val, struct compat_timespec *utime) { @@ -226,6 +226,7 @@ asmlinkage long compat_sys_futex(u32 *ua } return do_futex((unsigned long)uaddr, op, val, timeout); } +#endif asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit *rlim); diff -puN include/linux/futex.h~CONFIG_FUTEX include/linux/futex.h --- 25/include/linux/futex.h~CONFIG_FUTEX 2003-05-16 22:48:43.000000000 -0700 +++ 25-akpm/include/linux/futex.h 2003-05-16 22:48:43.000000000 -0700 @@ -8,4 +8,6 @@ extern asmlinkage long sys_futex(u32 __user *uaddr, int op, int val, struct timespec __user *utime); +long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout); + #endif _