summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-24 16:12:24 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-02-24 16:12:24 -0800
commit0bab064232c278cb484b6aaa790b9c626ab6524b (patch)
tree3c997ffac693fa0e1f157273fad383b6a0a752b2 /kernel
parent091704ef34f2e6aed8436877aeb434125b002c18 (diff)
[PATCH] add syscalls.h
From: "Randy.Dunlap" <rddunlap@osdl.org> Add syscalls.h, which contains prototypes for the kernel's system calls. Replace open-coded declarations all over the place. This patch found a couple of prior bugs. It appears to be more important with -mregparm=3 as we discover more asmlinkage mismatches. Some syscalls have arch-dependent arguments, so their prototypes are in the arch-specific unistd.h. Maybe it should have been asm/syscalls.h, but there were already arch-specific syscall prototypes in asm/unistd.h... Tested on x86, ia64, x86_64, ppc64, s390 and sparc64. May cause trivial-to-fix build breakage on other architectures.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/compat.c39
-rw-r--r--kernel/fork.c1
-rw-r--r--kernel/kmod.c1
-rw-r--r--kernel/module.c1
-rw-r--r--kernel/panic.c3
-rw-r--r--kernel/power/disk.c3
-rw-r--r--kernel/power/swsusp.c3
-rw-r--r--kernel/sysctl.c2
-rw-r--r--kernel/uid16.c13
9 files changed, 10 insertions, 56 deletions
diff --git a/kernel/compat.c b/kernel/compat.c
index 9bde07856201..fb89b3233b04 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -18,6 +18,7 @@
#include <linux/signal.h>
#include <linux/sched.h> /* for MAX_SCHEDULE_TIMEOUT */
#include <linux/futex.h> /* for FUTEX_WAIT */
+#include <linux/syscalls.h>
#include <linux/unistd.h>
#include <asm/uaccess.h>
@@ -172,8 +173,6 @@ asmlinkage long compat_sys_times(struct compat_tms *tbuf)
* types that can be passed to put_user()/get_user().
*/
-extern asmlinkage long sys_sigpending(old_sigset_t *);
-
asmlinkage long compat_sys_sigpending(compat_old_sigset_t *set)
{
old_sigset_t s;
@@ -188,8 +187,6 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t *set)
return ret;
}
-extern asmlinkage long sys_sigprocmask(int, old_sigset_t *, old_sigset_t *);
-
asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t *set,
compat_old_sigset_t *oset)
{
@@ -230,8 +227,6 @@ asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val,
}
#endif
-asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit *rlim);
-
asmlinkage long compat_sys_setrlimit(unsigned int resource, struct compat_rlimit *rlim)
{
struct rlimit r;
@@ -257,7 +252,6 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource, struct compat_rlimit
}
#ifdef COMPAT_RLIM_OLD_INFINITY
-asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit *rlim);
asmlinkage long compat_sys_old_getrlimit(unsigned int resource, struct compat_rlimit *rlim)
{
@@ -282,9 +276,8 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource, struct compat_rl
}
return ret;
}
-#endif
-asmlinkage long sys_getrlimit (unsigned int resource, struct rlimit *rlim);
+#endif
asmlinkage long compat_sys_getrlimit (unsigned int resource, struct compat_rlimit *rlim)
{
@@ -334,8 +327,6 @@ static long put_compat_rusage (struct compat_rusage *ru, struct rusage *r)
return 0;
}
-asmlinkage long sys_getrusage(int who, struct rusage *ru);
-
asmlinkage long compat_sys_getrusage(int who, struct compat_rusage *ru)
{
struct rusage r;
@@ -381,9 +372,6 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t * stat_addr, int options,
}
}
-extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
- unsigned long *user_mask_ptr);
-
asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
unsigned int len,
compat_ulong_t *user_mask_ptr)
@@ -405,9 +393,6 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
return ret;
}
-extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
- unsigned long *user_mask_ptr);
-
asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
compat_ulong_t *user_mask_ptr)
{
@@ -449,12 +434,6 @@ static int put_compat_itimerspec(struct compat_itimerspec *dst,
return 0;
}
-extern asmlinkage long sys_timer_settime(timer_t timer_id, int flags,
- struct itimerspec __user *new_setting,
- struct itimerspec __user *old_setting);
-extern asmlinkage long sys_timer_gettime(timer_t timer_id,
- struct itimerspec __user *setting);
-
long compat_timer_settime(timer_t timer_id, int flags,
struct compat_itimerspec *new,
struct compat_itimerspec *old)
@@ -487,9 +466,6 @@ long compat_timer_gettime(timer_t timer_id, struct compat_itimerspec *setting)
return err;
}
-extern asmlinkage long
-sys_clock_settime(clockid_t which_clock, struct timespec __user *tp);
-
long compat_clock_settime(clockid_t which_clock, struct compat_timespec *tp)
{
long err;
@@ -504,9 +480,6 @@ long compat_clock_settime(clockid_t which_clock, struct compat_timespec *tp)
return err;
}
-extern asmlinkage long
-sys_clock_gettime(clockid_t which_clock, struct timespec __user *tp);
-
long compat_clock_gettime(clockid_t which_clock, struct compat_timespec *tp)
{
long err;
@@ -521,9 +494,6 @@ long compat_clock_gettime(clockid_t which_clock, struct compat_timespec *tp)
return err;
}
-extern asmlinkage long
-sys_clock_getres(clockid_t which_clock, struct timespec __user *tp);
-
long compat_clock_getres(clockid_t which_clock, struct compat_timespec *tp)
{
long err;
@@ -538,11 +508,6 @@ long compat_clock_getres(clockid_t which_clock, struct compat_timespec *tp)
return err;
}
-extern asmlinkage long
-sys_clock_nanosleep(clockid_t which_clock, int flags,
- struct timespec __user *rqtp,
- struct timespec __user *rmtp);
-
long compat_clock_nanosleep(clockid_t which_clock, int flags,
struct compat_timespec __user *rqtp,
struct compat_timespec __user *rmtp)
diff --git a/kernel/fork.c b/kernel/fork.c
index 275a4117bdea..c0c180375a84 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -26,6 +26,7 @@
#include <linux/mman.h>
#include <linux/fs.h>
#include <linux/security.h>
+#include <linux/syscalls.h>
#include <linux/jiffies.h>
#include <linux/futex.h>
#include <linux/ptrace.h>
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 4312bf031a7d..5261de82029b 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -23,6 +23,7 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/sched.h>
+#include <linux/syscalls.h>
#include <linux/unistd.h>
#include <linux/kmod.h>
#include <linux/smp_lock.h>
diff --git a/kernel/module.c b/kernel/module.c
index dad61b3ec68f..50746c030506 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -24,6 +24,7 @@
#include <linux/vmalloc.h>
#include <linux/elf.h>
#include <linux/seq_file.h>
+#include <linux/syscalls.h>
#include <linux/fcntl.h>
#include <linux/rcupdate.h>
#include <linux/cpu.h>
diff --git a/kernel/panic.c b/kernel/panic.c
index f5863a571e9b..3c1581eb65bd 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -16,11 +16,10 @@
#include <linux/notifier.h>
#include <linux/init.h>
#include <linux/sysrq.h>
+#include <linux/syscalls.h>
#include <linux/interrupt.h>
#include <linux/nmi.h>
-asmlinkage void sys_sync(void); /* it's really int */
-
int panic_timeout;
int panic_on_oops;
int tainted;
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 0c11a298eb68..2d4cf319b8e1 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -12,6 +12,7 @@
#include <linux/suspend.h>
+#include <linux/syscalls.h>
#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/delay.h>
@@ -28,8 +29,6 @@ extern int pmdisk_read(void);
extern int pmdisk_restore(void);
extern int pmdisk_free(void);
-extern long sys_sync(void);
-
/**
* power_down - Shut machine down for hibernate.
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 95ce3d43b420..7ca52f296f78 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -59,6 +59,7 @@
#include <linux/buffer_head.h>
#include <linux/swapops.h>
#include <linux/bootmem.h>
+#include <linux/syscalls.h>
#include <linux/console.h>
#include <asm/uaccess.h>
@@ -68,8 +69,6 @@
#include "power.h"
-extern long sys_sync(void);
-
unsigned char software_suspend_enabled = 0;
extern void do_magic(int resume);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index a366a5f89dc5..1e6fc4218df8 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2029,7 +2029,7 @@ int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
#else /* CONFIG_SYSCTL */
-extern asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
+asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
{
return -ENOSYS;
}
diff --git a/kernel/uid16.c b/kernel/uid16.c
index 32685ca7049b..aa25b920c2b7 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -13,21 +13,10 @@
#include <linux/init.h>
#include <linux/highuid.h>
#include <linux/security.h>
+#include <linux/syscalls.h>
#include <asm/uaccess.h>
-extern asmlinkage long sys_chown(const char *, uid_t,gid_t);
-extern asmlinkage long sys_lchown(const char *, uid_t,gid_t);
-extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t);
-extern asmlinkage long sys_setregid(gid_t, gid_t);
-extern asmlinkage long sys_setgid(gid_t);
-extern asmlinkage long sys_setreuid(uid_t, uid_t);
-extern asmlinkage long sys_setuid(uid_t);
-extern asmlinkage long sys_setresuid(uid_t, uid_t, uid_t);
-extern asmlinkage long sys_setresgid(gid_t, gid_t, gid_t);
-extern asmlinkage long sys_setfsuid(uid_t);
-extern asmlinkage long sys_setfsgid(gid_t);
-
asmlinkage long sys_chown16(const char * filename, old_uid_t user, old_gid_t group)
{
return sys_chown(filename, low2highuid(user), low2highgid(group));