From: David Mosberger Below is a patch that tries to sanitize the dropping of unneeded system-call stubs in generic code. In some instances, it would be possible to move the optional system-call stubs into a library routine which would avoid the need for #ifdefs, but in many cases, doing so would require making several functions global (and possibly exporting additional data-structures in header-files). Furthermore, it would inhibit (automatic) inlining in the cases in the cases where the stubs are needed. For these reasons, the patch keeps the #ifdef-approach. This has been tested on ia64 and there were no objections from the arch-maintainers (and one positive response). The patch should be safe but arch-maintainers may want to take a second look to see if some __ARCH_WANT_foo macros should be removed for their architecture (I'm quite sure that's the case, but I wanted to play it safe and only preserved the status-quo in that regard). --- 25-akpm/fs/namespace.c | 5 +++++ 25-akpm/fs/open.c | 4 +++- 25-akpm/fs/read_write.c | 3 ++- 25-akpm/fs/readdir.c | 4 ++-- 25-akpm/fs/stat.c | 12 +++++------- 25-akpm/include/asm-alpha/signal.h | 1 - 25-akpm/include/asm-alpha/unistd.h | 13 +++++++++++++ 25-akpm/include/asm-arm/unistd.h | 19 +++++++++++++++++++ 25-akpm/include/asm-arm26/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-cris/unistd.h | 24 +++++++++++++++++++++++- 25-akpm/include/asm-h8300/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-i386/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-ia64/signal.h | 1 - 25-akpm/include/asm-ia64/unistd.h | 13 +++++++++++++ 25-akpm/include/asm-m68k/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-m68knommu/unistd.h | 23 +++++++++++++++++++++++ 25-akpm/include/asm-mips/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-parisc/unistd.h | 21 +++++++++++++++++++++ 25-akpm/include/asm-ppc/unistd.h | 22 ++++++++++++++++++++++ 25-akpm/include/asm-ppc64/unistd.h | 21 +++++++++++++++++++++ 25-akpm/include/asm-s390/unistd.h | 23 +++++++++++++++++++++++ 25-akpm/include/asm-sh/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-sparc/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-sparc64/signal.h | 2 -- 25-akpm/include/asm-sparc64/unistd.h | 21 +++++++++++++++++++++ 25-akpm/include/asm-um/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-v850/unistd.h | 24 ++++++++++++++++++++++++ 25-akpm/include/asm-x86_64/unistd.h | 22 ++++++++++++++++++++++ 25-akpm/ipc/util.c | 7 +++++-- 25-akpm/kernel/exit.c | 4 ++-- 25-akpm/kernel/sched.c | 4 +++- 25-akpm/kernel/signal.c | 25 +++++++++++++++---------- 25-akpm/kernel/sys.c | 10 +++++++++- 25-akpm/kernel/time.c | 5 +++-- 25-akpm/kernel/timer.c | 3 ++- 25-akpm/mm/fadvise.c | 5 +++++ 25-akpm/net/socket.c | 6 ++++++ 37 files changed, 504 insertions(+), 35 deletions(-) diff -puN fs/namespace.c~sanitise-unneeded-syscall-stubs fs/namespace.c --- 25/fs/namespace.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.346996056 -0700 +++ 25-akpm/fs/namespace.c 2004-05-20 17:46:00.404987240 -0700 @@ -22,6 +22,7 @@ #include #include #include +#include extern int __init init_rootfs(void); @@ -465,6 +466,8 @@ out: return retval; } +#ifdef __ARCH_WANT_SYS_OLDUMOUNT + /* * The 2.0 compatible umount. No flags. */ @@ -474,6 +477,8 @@ asmlinkage long sys_oldumount(char __use return sys_umount(name,0); } +#endif + static int mount_is_safe(struct nameidata *nd) { if (capable(CAP_SYS_ADMIN)) diff -puN fs/open.c~sanitise-unneeded-syscall-stubs fs/open.c --- 25/fs/open.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.348995752 -0700 +++ 25-akpm/fs/open.c 2004-05-20 17:46:00.405987088 -0700 @@ -23,6 +23,8 @@ #include #include +#include + int vfs_statfs(struct super_block *sb, struct kstatfs *buf) { int retval = -ENODEV; @@ -335,7 +337,7 @@ asmlinkage long sys_ftruncate64(unsigned } #endif -#if !(defined(__alpha__) || defined(__ia64__)) +#ifdef __ARCH_WANT_SYS_UTIME /* * sys_utime() can be implemented in user-level using sys_utimes(). diff -puN fs/readdir.c~sanitise-unneeded-syscall-stubs fs/readdir.c --- 25/fs/readdir.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.349995600 -0700 +++ 25-akpm/fs/readdir.c 2004-05-20 17:46:00.406986936 -0700 @@ -52,7 +52,7 @@ EXPORT_SYMBOL(vfs_readdir); #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) -#ifndef __ia64__ +#ifdef __ARCH_WANT_OLD_READDIR struct old_linux_dirent { unsigned long d_ino; @@ -115,7 +115,7 @@ out: return error; } -#endif /* !__ia64__ */ +#endif /* __ARCH_WANT_OLD_READDIR */ /* * New, all-improved, singing, dancing, iBCS2-compliant getdents() diff -puN fs/read_write.c~sanitise-unneeded-syscall-stubs fs/read_write.c --- 25/fs/read_write.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.350995448 -0700 +++ 25-akpm/fs/read_write.c 2004-05-20 17:46:00.405987088 -0700 @@ -15,6 +15,7 @@ #include #include +#include struct file_operations generic_ro_fops = { .llseek = generic_file_llseek, @@ -145,7 +146,7 @@ bad: } EXPORT_SYMBOL_GPL(sys_lseek); -#if !defined(__alpha__) +#ifdef __ARCH_WANT_SYS_LLSEEK asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t __user * result, unsigned int origin) diff -puN fs/stat.c~sanitise-unneeded-syscall-stubs fs/stat.c --- 25/fs/stat.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.351995296 -0700 +++ 25-akpm/fs/stat.c 2004-05-20 17:46:00.406986936 -0700 @@ -16,6 +16,7 @@ #include #include +#include void generic_fillattr(struct inode *inode, struct kstat *stat) { @@ -105,10 +106,7 @@ int vfs_fstat(unsigned int fd, struct ks EXPORT_SYMBOL(vfs_fstat); -#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \ - && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \ - && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \ - && !defined(__mips__) +#ifdef __ARCH_WANT_OLD_STAT /* * For backward compatibility? Maybe this should be moved @@ -178,7 +176,7 @@ asmlinkage long sys_fstat(unsigned int f return error; } -#endif +#endif /* __ARCH_WANT_OLD_STAT */ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) { @@ -284,7 +282,7 @@ asmlinkage long sys_readlink(const char /* ---------- LFS-64 ----------- */ -#if !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X) +#ifdef __ARCH_WANT_STAT64 static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) { @@ -352,7 +350,7 @@ asmlinkage long sys_fstat64(unsigned lon return error; } -#endif /* LFS-64 */ +#endif /* __ARCH_WANT_STAT64 */ void inode_add_bytes(struct inode *inode, loff_t bytes) { diff -puN include/asm-alpha/signal.h~sanitise-unneeded-syscall-stubs include/asm-alpha/signal.h --- 25/include/asm-alpha/signal.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.353994992 -0700 +++ 25-akpm/include/asm-alpha/signal.h 2004-05-20 17:46:00.407986784 -0700 @@ -187,7 +187,6 @@ struct sigstack { #include #define ptrace_signal_deliver(regs, cookie) do { } while (0) -#define HAVE_ARCH_SYS_PAUSE #endif diff -puN include/asm-alpha/unistd.h~sanitise-unneeded-syscall-stubs include/asm-alpha/unistd.h --- 25/include/asm-alpha/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.354994840 -0700 +++ 25-akpm/include/asm-alpha/unistd.h 2004-05-20 17:46:00.407986784 -0700 @@ -558,6 +558,19 @@ type name (type1 arg1,type2 arg2,type3 a #endif /* __LIBRARY__ && __GNUC__ */ +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-arm26/unistd.h~sanitise-unneeded-syscall-stubs include/asm-arm26/unistd.h --- 25/include/asm-arm26/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.355994688 -0700 +++ 25-akpm/include/asm-arm26/unistd.h 2004-05-20 17:46:00.409986480 -0700 @@ -375,6 +375,30 @@ type name(type1 arg1, type2 arg2, type3 __syscall_return(type,__res); \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-arm/unistd.h~sanitise-unneeded-syscall-stubs include/asm-arm/unistd.h --- 25/include/asm-arm/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.357994384 -0700 +++ 25-akpm/include/asm-arm/unistd.h 2004-05-20 17:46:00.408986632 -0700 @@ -448,6 +448,25 @@ type name(type1 arg1, type2 arg2, type3 __syscall_return(type,__res); \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-cris/unistd.h~sanitise-unneeded-syscall-stubs include/asm-cris/unistd.h --- 25/include/asm-cris/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.358994232 -0700 +++ 25-akpm/include/asm-cris/unistd.h 2004-05-20 17:46:00.409986480 -0700 @@ -279,7 +279,29 @@ #define NR_syscalls 270 - +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif #ifdef __KERNEL_SYSCALLS__ diff -puN include/asm-h8300/unistd.h~sanitise-unneeded-syscall-stubs include/asm-h8300/unistd.h --- 25/include/asm-h8300/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.359994080 -0700 +++ 25-akpm/include/asm-h8300/unistd.h 2004-05-20 17:46:00.410986328 -0700 @@ -446,6 +446,30 @@ type name(atype a, btype b, ctype c, dty } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-i386/unistd.h~sanitise-unneeded-syscall-stubs include/asm-i386/unistd.h --- 25/include/asm-i386/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.361993776 -0700 +++ 25-akpm/include/asm-i386/unistd.h 2004-05-20 17:46:00.410986328 -0700 @@ -381,6 +381,30 @@ __asm__ volatile ("push %%ebp ; movl %%e __syscall_return(type,__res); \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-ia64/signal.h~sanitise-unneeded-syscall-stubs include/asm-ia64/signal.h --- 25/include/asm-ia64/signal.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.362993624 -0700 +++ 25-akpm/include/asm-ia64/signal.h 2004-05-20 17:46:00.411986176 -0700 @@ -176,7 +176,6 @@ struct k_sigaction { # include #define ptrace_signal_deliver(regs, cookie) do { } while (0) -#define HAVE_ARCH_SYS_PAUSE #endif /* __KERNEL__ */ diff -puN include/asm-ia64/unistd.h~sanitise-unneeded-syscall-stubs include/asm-ia64/unistd.h --- 25/include/asm-ia64/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.363993472 -0700 +++ 25-akpm/include/asm-ia64/unistd.h 2004-05-20 17:46:00.411986176 -0700 @@ -261,8 +261,21 @@ #ifdef __KERNEL__ +#include + #define NR_syscalls 256 /* length of syscall table */ +#ifdef CONFIG_IA32_SUPPORT +# define __ARCH_WANT_SYS_FADVISE64 +# define __ARCH_WANT_SYS_GETPGRP +# define __ARCH_WANT_SYS_LLSEEK +# define __ARCH_WANT_SYS_NICE +# define __ARCH_WANT_SYS_OLD_GETRLIMIT +# define __ARCH_WANT_SYS_OLDUMOUNT +# define __ARCH_WANT_SYS_SIGPENDING +# define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) #include diff -puN include/asm-m68knommu/unistd.h~sanitise-unneeded-syscall-stubs include/asm-m68knommu/unistd.h --- 25/include/asm-m68knommu/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.364993320 -0700 +++ 25-akpm/include/asm-m68knommu/unistd.h 2004-05-20 17:46:00.412986024 -0700 @@ -372,6 +372,29 @@ type name(atype a, btype b, ctype c, dty return (type)__res; \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif #ifdef __KERNEL_SYSCALLS__ diff -puN include/asm-m68k/unistd.h~sanitise-unneeded-syscall-stubs include/asm-m68k/unistd.h --- 25/include/asm-m68k/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.366993016 -0700 +++ 25-akpm/include/asm-m68k/unistd.h 2004-05-20 17:46:00.412986024 -0700 @@ -337,6 +337,30 @@ __asm__ __volatile__ ("trap #0" \ __syscall_return(type,__res); \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-mips/unistd.h~sanitise-unneeded-syscall-stubs include/asm-mips/unistd.h --- 25/include/asm-mips/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.367992864 -0700 +++ 25-akpm/include/asm-mips/unistd.h 2004-05-20 17:46:00.414985720 -0700 @@ -1072,6 +1072,30 @@ type name (atype a,btype b,ctype c,dtype #endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */ +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +# ifndef __mips64 +# define __ARCH_WANT_STAT64 +# endif +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-parisc/unistd.h~sanitise-unneeded-syscall-stubs include/asm-parisc/unistd.h --- 25/include/asm-parisc/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.368992712 -0700 +++ 25-akpm/include/asm-parisc/unistd.h 2004-05-20 17:46:00.415985568 -0700 @@ -879,6 +879,27 @@ type name(type1 arg1, type2 arg2, type3 return K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif /* mmap & mmap2 take 6 arguments */ #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ diff -puN include/asm-ppc64/unistd.h~sanitise-unneeded-syscall-stubs include/asm-ppc64/unistd.h --- 25/include/asm-ppc64/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.370992408 -0700 +++ 25-akpm/include/asm-ppc64/unistd.h 2004-05-20 17:46:00.416985416 -0700 @@ -419,6 +419,27 @@ static inline _syscall3(int, execve, __c #include #include +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK + unsigned long sys_mmap(unsigned long addr, size_t len, unsigned long prot, unsigned long flags, unsigned long fd, off_t offset); struct pt_regs; diff -puN include/asm-ppc/unistd.h~sanitise-unneeded-syscall-stubs include/asm-ppc/unistd.h --- 25/include/asm-ppc/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.371992256 -0700 +++ 25-akpm/include/asm-ppc/unistd.h 2004-05-20 17:46:00.416985416 -0700 @@ -381,6 +381,28 @@ type name(type1 arg1, type2 arg2, type3 #define __NR__exit __NR_exit #define NR_syscalls __NR_syscalls +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK + /* * Forking from kernel space will result in the child getting a new, * empty kernel stack area. Thus the child cannot access automatic diff -puN include/asm-s390/unistd.h~sanitise-unneeded-syscall-stubs include/asm-s390/unistd.h --- 25/include/asm-s390/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.373991952 -0700 +++ 25-akpm/include/asm-s390/unistd.h 2004-05-20 17:46:00.417985264 -0700 @@ -512,6 +512,29 @@ type name(type1 arg1, type2 arg2, type3 __syscall_return(type,__res); \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +# ifndef CONFIG_ARCH_S390X +# define __ARCH_WANT_STAT64 +# endif +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-sh/unistd.h~sanitise-unneeded-syscall-stubs include/asm-sh/unistd.h --- 25/include/asm-sh/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.374991800 -0700 +++ 25-akpm/include/asm-sh/unistd.h 2004-05-20 17:46:00.418985112 -0700 @@ -400,6 +400,30 @@ __asm__ __volatile__ ("trapa #0x15" \ __syscall_return(type,__sc0); \ } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-sparc64/signal.h~sanitise-unneeded-syscall-stubs include/asm-sparc64/signal.h --- 25/include/asm-sparc64/signal.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.375991648 -0700 +++ 25-akpm/include/asm-sparc64/signal.h 2004-05-20 17:46:00.419984960 -0700 @@ -253,8 +253,6 @@ struct signal_deliver_cookie { struct pt_regs; extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie); -#define HAVE_ARCH_SYS_PAUSE - #endif /* !(__KERNEL__) */ #endif /* !(__ASSEMBLY__) */ diff -puN include/asm-sparc64/unistd.h~sanitise-unneeded-syscall-stubs include/asm-sparc64/unistd.h --- 25/include/asm-sparc64/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.376991496 -0700 +++ 25-akpm/include/asm-sparc64/unistd.h 2004-05-20 17:46:00.420984808 -0700 @@ -474,6 +474,27 @@ asmlinkage long sys_rt_sigaction(int sig #define _SC_JOB_CONTROL 6 #define _SC_SAVED_IDS 7 #define _SC_VERSION 8 + +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK #endif /* diff -puN include/asm-sparc/unistd.h~sanitise-unneeded-syscall-stubs include/asm-sparc/unistd.h --- 25/include/asm-sparc/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.378991192 -0700 +++ 25-akpm/include/asm-sparc/unistd.h 2004-05-20 17:46:00.418985112 -0700 @@ -431,6 +431,30 @@ if (__res < -255 || __res>=0) \ errno = -__res; \ return -1; \ } + +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-um/unistd.h~sanitise-unneeded-syscall-stubs include/asm-um/unistd.h --- 25/include/asm-um/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.379991040 -0700 +++ 25-akpm/include/asm-um/unistd.h 2004-05-20 17:46:00.420984808 -0700 @@ -12,6 +12,30 @@ extern int um_execve(const char *file, char *const argv[], char *const env[]); +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-v850/unistd.h~sanitise-unneeded-syscall-stubs include/asm-v850/unistd.h --- 25/include/asm-v850/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.380990888 -0700 +++ 25-akpm/include/asm-v850/unistd.h 2004-05-20 17:46:00.421984656 -0700 @@ -386,6 +386,30 @@ type name (atype a, btype b, ctype c, dt } +#ifdef __KERNEL__ +#define __ARCH_WANT_IPC_PARSE_VERSION +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_STAT64 +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifdef __KERNEL_SYSCALLS__ #include diff -puN include/asm-x86_64/unistd.h~sanitise-unneeded-syscall-stubs include/asm-x86_64/unistd.h --- 25/include/asm-x86_64/unistd.h~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.382990584 -0700 +++ 25-akpm/include/asm-x86_64/unistd.h 2004-05-20 17:46:00.421984656 -0700 @@ -571,6 +571,28 @@ do { \ return (type) (res); \ } while (0) +#ifdef __KERNEL__ +#define __ARCH_WANT_OLD_READDIR +#define __ARCH_WANT_OLD_STAT +#define __ARCH_WANT_SYS_ALARM +#define __ARCH_WANT_SYS_GETHOSTNAME +#define __ARCH_WANT_SYS_PAUSE +#define __ARCH_WANT_SYS_SGETMASK +#define __ARCH_WANT_SYS_SIGNAL +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_WAITPID +#define __ARCH_WANT_SYS_SOCKETCALL +#define __ARCH_WANT_SYS_FADVISE64 +#define __ARCH_WANT_SYS_GETPGRP +#define __ARCH_WANT_SYS_LLSEEK +#define __ARCH_WANT_SYS_NICE +#define __ARCH_WANT_SYS_OLD_GETRLIMIT +#define __ARCH_WANT_SYS_OLDUMOUNT +#define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_SIGPROCMASK +#endif + #ifndef __KERNEL_SYSCALLS__ #define __syscall "syscall" diff -puN ipc/util.c~sanitise-unneeded-syscall-stubs ipc/util.c --- 25/ipc/util.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.383990432 -0700 +++ 25-akpm/ipc/util.c 2004-05-20 17:46:00.422984504 -0700 @@ -25,6 +25,8 @@ #include #include +#include + #include "util.h" /** @@ -507,7 +509,8 @@ int ipc_checkid(struct ipc_ids* ids, str return 0; } -#if !defined(__ia64__) && !defined(__x86_64__) && !defined(__hppa__) +#ifdef __ARCH_WANT_IPC_PARSE_VERSION + /** * ipc_parse_version - IPC call version @@ -528,4 +531,4 @@ int ipc_parse_version (int *cmd) } } -#endif /* __ia64__ */ +#endif /* __ARCH_WANT_IPC_PARSE_VERSION */ diff -puN kernel/exit.c~sanitise-unneeded-syscall-stubs kernel/exit.c --- 25/kernel/exit.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.384990280 -0700 +++ 25-akpm/kernel/exit.c 2004-05-20 17:46:00.423984352 -0700 @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -1161,8 +1162,7 @@ end_wait4: return retval; } -#if !defined(__alpha__) && !defined(__ia64__) && \ - !defined(__arm__) && !defined(__s390__) +#ifdef __ARCH_WANT_SYS_WAITPID /* * sys_waitpid() remains for compatibility. waitpid() should be diff -puN kernel/sched.c~sanitise-unneeded-syscall-stubs kernel/sched.c --- 25/kernel/sched.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.386989976 -0700 +++ 25-akpm/kernel/sched.c 2004-05-20 17:46:00.428983592 -0700 @@ -43,6 +43,8 @@ #include #include +#include + #ifdef CONFIG_NUMA #define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu)) #else @@ -2759,7 +2761,7 @@ struct task_struct * kgdb_get_idle(int t } #endif -#ifndef __alpha__ +#ifdef __ARCH_WANT_SYS_NICE /* * sys_nice - change the priority of the current process. diff -puN kernel/signal.c~sanitise-unneeded-syscall-stubs kernel/signal.c --- 25/kernel/signal.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.387989824 -0700 +++ 25-akpm/kernel/signal.c 2004-05-20 17:46:00.430983288 -0700 @@ -23,6 +23,7 @@ #include #include #include +#include #include /* @@ -2415,14 +2416,19 @@ out: return error; } +#ifdef __ARCH_WANT_SYS_SIGPENDING + asmlinkage long sys_sigpending(old_sigset_t __user *set) { return do_sigpending(set, sizeof(*set)); } -#if !defined(__alpha__) -/* Alpha has its own versions with special arguments. */ +#endif + +#ifdef __ARCH_WANT_SYS_SIGPROCMASK +/* Some platforms have their own version with special arguments others + support only sys_rt_sigprocmask. */ asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset) @@ -2504,8 +2510,8 @@ out: #endif /* __sparc__ */ #endif -#if !defined(__alpha__) && !defined(__ia64__) && \ - !defined(__arm__) && !defined(__s390__) +#ifdef __ARCH_WANT_SYS_SGETMASK + /* * For backwards compatibility. Functionality superseded by sigprocmask. */ @@ -2531,10 +2537,9 @@ sys_ssetmask(int newmask) return old; } -#endif /* !defined(__alpha__) */ +#endif /* __ARCH_WANT_SGETMASK */ -#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && \ - !defined(__arm__) +#ifdef __ARCH_WANT_SYS_SIGNAL /* * For backwards compatibility. Functionality superseded by sigaction. */ @@ -2551,9 +2556,9 @@ sys_signal(int sig, __sighandler_t handl return ret ? ret : (unsigned long)old_sa.sa.sa_handler; } -#endif /* !alpha && !__ia64__ && !defined(__mips__) && !defined(__arm__) */ +#endif /* __ARCH_WANT_SYS_SIGNAL */ -#ifndef HAVE_ARCH_SYS_PAUSE +#ifdef __ARCH_WANT_SYS_PAUSE asmlinkage long sys_pause(void) @@ -2563,7 +2568,7 @@ sys_pause(void) return -ERESTARTNOHAND; } -#endif /* HAVE_ARCH_SYS_PAUSE */ +#endif void __init signals_init(void) { diff -puN kernel/sys.c~sanitise-unneeded-syscall-stubs kernel/sys.c --- 25/kernel/sys.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.389989520 -0700 +++ 25-akpm/kernel/sys.c 2004-05-20 17:46:00.431983136 -0700 @@ -1063,12 +1063,16 @@ asmlinkage long sys_getpgid(pid_t pid) } } +#ifdef __ARCH_WANT_SYS_GETPGRP + asmlinkage long sys_getpgrp(void) { /* SMP - assuming writes are word atomic this is fine */ return process_group(current); } +#endif + asmlinkage long sys_getsid(pid_t pid) { if (!pid) { @@ -1409,6 +1413,8 @@ asmlinkage long sys_sethostname(char __u return errno; } +#ifdef __ARCH_WANT_SYS_GETHOSTNAME + asmlinkage long sys_gethostname(char __user *name, int len) { int i, errno; @@ -1426,6 +1432,8 @@ asmlinkage long sys_gethostname(char __u return errno; } +#endif + /* * Only setdomainname; getdomainname can be implemented by calling * uname() @@ -1460,7 +1468,7 @@ asmlinkage long sys_getrlimit(unsigned i ? -EFAULT : 0; } -#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64) || defined(CONFIG_V850)) +#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT /* * Back compatibility for getrlimit. Needed for some apps. diff -puN kernel/time.c~sanitise-unneeded-syscall-stubs kernel/time.c --- 25/kernel/time.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.390989368 -0700 +++ 25-akpm/kernel/time.c 2004-05-20 17:46:00.432982984 -0700 @@ -29,6 +29,7 @@ #include #include #include +#include /* * The timezone where the local system is located. Used as a default by some @@ -38,7 +39,7 @@ struct timezone sys_tz; EXPORT_SYMBOL(sys_tz); -#if !defined(__alpha__) && !defined(__ia64__) +#ifdef __ARCH_WANT_SYS_TIME /* * sys_time() can be implemented in user-level using @@ -84,7 +85,7 @@ asmlinkage long sys_stime(time_t *tptr) return 0; } -#endif +#endif /* __ARCH_WANT_SYS_TIME */ asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz) { diff -puN kernel/timer.c~sanitise-unneeded-syscall-stubs kernel/timer.c --- 25/kernel/timer.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.392989064 -0700 +++ 25-akpm/kernel/timer.c 2004-05-20 17:46:00.433982832 -0700 @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -952,7 +953,7 @@ void do_timer(struct pt_regs *regs) update_times(); } -#if !defined(__alpha__) && !defined(__ia64__) +#ifdef __ARCH_WANT_SYS_ALARM /* * For backwards compatibility? This can be done in libc so Alpha diff -puN mm/fadvise.c~sanitise-unneeded-syscall-stubs mm/fadvise.c --- 25/mm/fadvise.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.393988912 -0700 +++ 25-akpm/mm/fadvise.c 2004-05-20 17:46:00.433982832 -0700 @@ -16,6 +16,8 @@ #include #include +#include + /* * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could * deactivate the pages and clear PG_Referenced. @@ -98,8 +100,11 @@ out: return ret; } +#ifdef __ARCH_WANT_SYS_FADVISE64 + asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice) { return sys_fadvise64_64(fd, offset, len, advice); } +#endif diff -puN net/socket.c~sanitise-unneeded-syscall-stubs net/socket.c --- 25/net/socket.c~sanitise-unneeded-syscall-stubs 2004-05-20 17:46:00.394988760 -0700 +++ 25-akpm/net/socket.c 2004-05-20 17:46:00.434982680 -0700 @@ -87,6 +87,8 @@ #endif /* CONFIG_NET_RADIO */ #include +#include + #include #include @@ -1817,6 +1819,8 @@ out: return err; } +#ifdef __ARCH_WANT_SYS_SOCKETCALL + /* Argument list sizes for sys_socketcall */ #define AL(x) ((x) * sizeof(unsigned long)) static unsigned char nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), @@ -1910,6 +1914,8 @@ asmlinkage long sys_socketcall(int call, return err; } +#endif /* __ARCH_WANT_SYS_SOCKETCALL */ + /* * This function is called by a protocol handler that wants to * advertise its address family, and have it linked into the _