Commit 581ae915 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Sanitise handling of unneeded syscall stubs

From: David Mosberger <davidm@napali.hpl.hp.com>

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).
parent 2b590e85
......@@ -22,6 +22,7 @@
#include <linux/security.h>
#include <linux/mount.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
extern int __init init_rootfs(void);
......@@ -465,6 +466,8 @@ asmlinkage long sys_umount(char __user * name, int flags)
return retval;
}
#ifdef __ARCH_WANT_SYS_OLDUMOUNT
/*
* The 2.0 compatible umount. No flags.
*/
......@@ -474,6 +477,8 @@ asmlinkage long sys_oldumount(char __user * name)
return sys_umount(name,0);
}
#endif
static int mount_is_safe(struct nameidata *nd)
{
if (capable(CAP_SYS_ADMIN))
......
......@@ -23,6 +23,8 @@
#include <linux/fs.h>
#include <linux/pagemap.h>
#include <asm/unistd.h>
int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
{
int retval = -ENODEV;
......@@ -335,7 +337,7 @@ asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
}
#endif
#if !(defined(__alpha__) || defined(__ia64__))
#ifdef __ARCH_WANT_SYS_UTIME
/*
* sys_utime() can be implemented in user-level using sys_utimes().
......
......@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
struct file_operations generic_ro_fops = {
.llseek = generic_file_llseek,
......@@ -145,7 +146,7 @@ asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
}
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)
......
......@@ -14,6 +14,7 @@
#include <linux/fs.h>
#include <linux/dirent.h>
#include <linux/security.h>
#include <linux/unistd.h>
#include <asm/uaccess.h>
......@@ -52,7 +53,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 +116,7 @@ asmlinkage long old_readdir(unsigned int fd, struct old_linux_dirent __user * di
return error;
}
#endif /* !__ia64__ */
#endif /* __ARCH_WANT_OLD_READDIR */
/*
* New, all-improved, singing, dancing, iBCS2-compliant getdents()
......
......@@ -16,6 +16,7 @@
#include <linux/security.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
void generic_fillattr(struct inode *inode, struct kstat *stat)
{
......@@ -105,10 +106,7 @@ int vfs_fstat(unsigned int fd, struct kstat *stat)
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 fd, struct __old_kernel_stat __user * sta
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 __user * path, char __user * buf, int bu
/* ---------- 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 long fd, struct stat64 __user * statbuf)
return error;
}
#endif /* LFS-64 */
#endif /* __ARCH_WANT_STAT64 */
void inode_add_bytes(struct inode *inode, loff_t bytes)
{
......
......@@ -187,7 +187,6 @@ struct sigstack {
#include <asm/sigcontext.h>
#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#define HAVE_ARCH_SYS_PAUSE
#endif
......
......@@ -558,6 +558,19 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6)\
#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 <linux/compiler.h>
......
......@@ -448,6 +448,25 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
__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 <linux/compiler.h>
......
......@@ -375,6 +375,30 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
__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 <linux/compiler.h>
......
......@@ -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__
......
......@@ -446,6 +446,30 @@ type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \
}
#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 <linux/compiler.h>
......
......@@ -381,6 +381,30 @@ __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; p
__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 <linux/compiler.h>
......
......@@ -176,7 +176,6 @@ struct k_sigaction {
# include <asm/sigcontext.h>
#define ptrace_signal_deliver(regs, cookie) do { } while (0)
#define HAVE_ARCH_SYS_PAUSE
#endif /* __KERNEL__ */
......
......@@ -261,8 +261,21 @@
#ifdef __KERNEL__
#include <linux/config.h>
#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 <linux/types.h>
......
......@@ -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 <linux/compiler.h>
......
......@@ -372,6 +372,29 @@ type name(atype a, btype b, ctype c, dtype d, etype e) \
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__
......
......@@ -1072,6 +1072,30 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
#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 <linux/compiler.h>
......
......@@ -879,6 +879,27 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
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) \
......
......@@ -381,6 +381,28 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
#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
......
......@@ -419,6 +419,27 @@ static inline _syscall3(int, execve, __const__ char *, file, char **, argv,
#include <linux/compiler.h>
#include <linux/linkage.h>
#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;
......
......@@ -512,6 +512,29 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
__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 <linux/config.h>
......
......@@ -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 <linux/compiler.h>
......
......@@ -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 <linux/compiler.h>
......
......@@ -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__) */
......
......@@ -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
/*
......
......@@ -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 <linux/compiler.h>
......
......@@ -386,6 +386,30 @@ type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \
}
#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 <linux/compiler.h>
......
......@@ -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"
......
......@@ -25,6 +25,8 @@
#include <linux/rcupdate.h>
#include <linux/workqueue.h>
#include <asm/unistd.h>
#include "util.h"
/**
......@@ -507,7 +509,8 @@ int ipc_checkid(struct ipc_ids* ids, struct kern_ipc_perm* ipcp, int uid)
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 */
......@@ -24,6 +24,7 @@
#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <asm/pgtable.h>
#include <asm/mmu_context.h>
......@@ -1157,8 +1158,7 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc
return retval;
}
#if !defined(__alpha__) && !defined(__ia64__) && \
!defined(__arm__) && !defined(__s390__)
#ifdef __ARCH_WANT_SYS_WAITPID
/*
* sys_waitpid() remains for compatibility. waitpid() should be
......
......@@ -41,6 +41,8 @@
#include <linux/percpu.h>
#include <linux/kthread.h>
#include <asm/unistd.h>
#ifdef CONFIG_NUMA
#define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
#else
......@@ -2587,7 +2589,7 @@ void set_user_nice(task_t *p, long nice)
EXPORT_SYMBOL(set_user_nice);
#ifndef __alpha__
#ifdef __ARCH_WANT_SYS_NICE
/*
* sys_nice - change the priority of the current process.
......
......@@ -23,6 +23,7 @@
#include <linux/ptrace.h>
#include <asm/param.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <asm/siginfo.h>
/*
......@@ -2412,14 +2413,19 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
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)
......@@ -2501,8 +2507,8 @@ sys_rt_sigaction(int sig,
#endif /* __sparc__ */
#endif
#if !defined(__alpha__) && !defined(__ia64__) && \
!defined(__arm__) && !defined(__s390__)
#ifdef __ARCH_WANT_SYS_SGETMASK
/*
* For backwards compatibility. Functionality superseded by sigprocmask.
*/
......@@ -2528,10 +2534,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.
*/
......@@ -2548,9 +2553,9 @@ sys_signal(int sig, __sighandler_t handler)
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)
......@@ -2560,7 +2565,7 @@ sys_pause(void)
return -ERESTARTNOHAND;
}
#endif /* HAVE_ARCH_SYS_PAUSE */
#endif
void __init signals_init(void)
{
......
......@@ -1060,12 +1060,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) {
......@@ -1406,6 +1410,8 @@ asmlinkage long sys_sethostname(char __user *name, int len)
return errno;
}
#ifdef __ARCH_WANT_SYS_GETHOSTNAME
asmlinkage long sys_gethostname(char __user *name, int len)
{
int i, errno;
......@@ -1423,6 +1429,8 @@ asmlinkage long sys_gethostname(char __user *name, int len)
return errno;
}
#endif
/*
* Only setdomainname; getdomainname can be implemented by calling
* uname()
......@@ -1457,7 +1465,7 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim)
? -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.
......
......@@ -29,6 +29,7 @@
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
/*
* 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)
{
......
......@@ -33,6 +33,7 @@
#include <linux/cpu.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <asm/div64.h>
#include <asm/timex.h>
......@@ -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
......
......@@ -16,6 +16,8 @@
#include <linux/pagevec.h>
#include <linux/fadvise.h>
#include <asm/unistd.h>
/*
* POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
* deactivate the pages and clear PG_Referenced.
......@@ -98,8 +100,11 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
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
......@@ -87,6 +87,8 @@
#endif /* CONFIG_NET_RADIO */
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <net/compat.h>
#include <net/sock.h>
......@@ -1817,6 +1819,8 @@ asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flag
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, unsigned long __user *args)
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment