diff options
-rw-r--r-- | arch/alpha/kernel/alpha_ksyms.c | 3 | ||||
-rw-r--r-- | arch/alpha/kernel/entry.S | 10 | ||||
-rw-r--r-- | arch/arm/kernel/sys_arm.c | 4 | ||||
-rw-r--r-- | arch/arm26/kernel/sys_arm.c | 4 | ||||
-rw-r--r-- | arch/ia64/kernel/entry.S | 4 | ||||
-rw-r--r-- | arch/parisc/kernel/process.c | 9 | ||||
-rw-r--r-- | arch/powerpc/kernel/misc_32.S | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/misc_64.S | 2 | ||||
-rw-r--r-- | arch/um/kernel/syscall.c | 13 | ||||
-rw-r--r-- | arch/x86_64/kernel/entry.S | 4 | ||||
-rw-r--r-- | drivers/sbus/char/bbc_envctrl.c | 5 | ||||
-rw-r--r-- | drivers/sbus/char/envctrl.c | 7 | ||||
-rw-r--r-- | include/asm-alpha/unistd.h | 69 | ||||
-rw-r--r-- | include/asm-arm/unistd.h | 24 | ||||
-rw-r--r-- | include/asm-arm26/unistd.h | 24 | ||||
-rw-r--r-- | include/asm-ia64/unistd.h | 72 | ||||
-rw-r--r-- | include/asm-parisc/unistd.h | 86 | ||||
-rw-r--r-- | include/asm-powerpc/unistd.h | 7 | ||||
-rw-r--r-- | include/asm-um/unistd.h | 28 | ||||
-rw-r--r-- | include/asm-x86_64/unistd.h | 93 | ||||
-rw-r--r-- | include/linux/syscalls.h | 2 |
21 files changed, 49 insertions, 423 deletions
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c index f042cc42b00f..dbe327d32b6f 100644 --- a/arch/alpha/kernel/alpha_ksyms.c +++ b/arch/alpha/kernel/alpha_ksyms.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
37 | #include <asm/vga.h> | 37 | #include <asm/vga.h> |
38 | 38 | ||
39 | #define __KERNEL_SYSCALLS__ | ||
40 | #include <asm/unistd.h> | 39 | #include <asm/unistd.h> |
41 | 40 | ||
42 | extern struct hwrpb_struct *hwrpb; | 41 | extern struct hwrpb_struct *hwrpb; |
@@ -116,7 +115,7 @@ EXPORT_SYMBOL(sys_dup); | |||
116 | EXPORT_SYMBOL(sys_exit); | 115 | EXPORT_SYMBOL(sys_exit); |
117 | EXPORT_SYMBOL(sys_write); | 116 | EXPORT_SYMBOL(sys_write); |
118 | EXPORT_SYMBOL(sys_lseek); | 117 | EXPORT_SYMBOL(sys_lseek); |
119 | EXPORT_SYMBOL(execve); | 118 | EXPORT_SYMBOL(kernel_execve); |
120 | EXPORT_SYMBOL(sys_setsid); | 119 | EXPORT_SYMBOL(sys_setsid); |
121 | EXPORT_SYMBOL(sys_wait4); | 120 | EXPORT_SYMBOL(sys_wait4); |
122 | 121 | ||
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index 01ecd09d4a64..c95e95e1ab04 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -655,12 +655,12 @@ kernel_thread: | |||
655 | .end kernel_thread | 655 | .end kernel_thread |
656 | 656 | ||
657 | /* | 657 | /* |
658 | * execve(path, argv, envp) | 658 | * kernel_execve(path, argv, envp) |
659 | */ | 659 | */ |
660 | .align 4 | 660 | .align 4 |
661 | .globl execve | 661 | .globl kernel_execve |
662 | .ent execve | 662 | .ent kernel_execve |
663 | execve: | 663 | kernel_execve: |
664 | /* We can be called from a module. */ | 664 | /* We can be called from a module. */ |
665 | ldgp $gp, 0($27) | 665 | ldgp $gp, 0($27) |
666 | lda $sp, -(32+SIZEOF_PT_REGS+8)($sp) | 666 | lda $sp, -(32+SIZEOF_PT_REGS+8)($sp) |
@@ -704,7 +704,7 @@ execve: | |||
704 | 704 | ||
705 | 1: lda $sp, 32+SIZEOF_PT_REGS+8($sp) | 705 | 1: lda $sp, 32+SIZEOF_PT_REGS+8($sp) |
706 | ret | 706 | ret |
707 | .end execve | 707 | .end kernel_execve |
708 | 708 | ||
709 | 709 | ||
710 | /* | 710 | /* |
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index 8170af471439..00c18d35913c 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c | |||
@@ -279,7 +279,7 @@ out: | |||
279 | return error; | 279 | return error; |
280 | } | 280 | } |
281 | 281 | ||
282 | long execve(const char *filename, char **argv, char **envp) | 282 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) |
283 | { | 283 | { |
284 | struct pt_regs regs; | 284 | struct pt_regs regs; |
285 | int ret; | 285 | int ret; |
@@ -317,7 +317,7 @@ long execve(const char *filename, char **argv, char **envp) | |||
317 | out: | 317 | out: |
318 | return ret; | 318 | return ret; |
319 | } | 319 | } |
320 | EXPORT_SYMBOL(execve); | 320 | EXPORT_SYMBOL(kernel_execve); |
321 | 321 | ||
322 | /* | 322 | /* |
323 | * Since loff_t is a 64 bit type we avoid a lot of ABI hastle | 323 | * Since loff_t is a 64 bit type we avoid a lot of ABI hastle |
diff --git a/arch/arm26/kernel/sys_arm.c b/arch/arm26/kernel/sys_arm.c index 85457897b8a9..dc05aba58baf 100644 --- a/arch/arm26/kernel/sys_arm.c +++ b/arch/arm26/kernel/sys_arm.c | |||
@@ -283,7 +283,7 @@ out: | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /* FIXME - see if this is correct for arm26 */ | 285 | /* FIXME - see if this is correct for arm26 */ |
286 | long execve(const char *filename, char **argv, char **envp) | 286 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) |
287 | { | 287 | { |
288 | struct pt_regs regs; | 288 | struct pt_regs regs; |
289 | int ret; | 289 | int ret; |
@@ -320,4 +320,4 @@ long execve(const char *filename, char **argv, char **envp) | |||
320 | return ret; | 320 | return ret; |
321 | } | 321 | } |
322 | 322 | ||
323 | EXPORT_SYMBOL(execve); | 323 | EXPORT_SYMBOL(kernel_execve); |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 12701cf32d99..e5b1be51b197 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -492,11 +492,11 @@ GLOBAL_ENTRY(prefetch_stack) | |||
492 | br.ret.sptk.many rp | 492 | br.ret.sptk.many rp |
493 | END(prefetch_stack) | 493 | END(prefetch_stack) |
494 | 494 | ||
495 | GLOBAL_ENTRY(execve) | 495 | GLOBAL_ENTRY(kernel_execve) |
496 | mov r15=__NR_execve // put syscall number in place | 496 | mov r15=__NR_execve // put syscall number in place |
497 | break __BREAK_SYSCALL | 497 | break __BREAK_SYSCALL |
498 | br.ret.sptk.many rp | 498 | br.ret.sptk.many rp |
499 | END(execve) | 499 | END(kernel_execve) |
500 | 500 | ||
501 | GLOBAL_ENTRY(clone) | 501 | GLOBAL_ENTRY(clone) |
502 | mov r15=__NR_clone // put syscall number in place | 502 | mov r15=__NR_clone // put syscall number in place |
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 0b485ef4be89..2f9f9dfa66f7 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c | |||
@@ -368,7 +368,14 @@ out: | |||
368 | return error; | 368 | return error; |
369 | } | 369 | } |
370 | 370 | ||
371 | unsigned long | 371 | extern int __execve(const char *filename, char *const argv[], |
372 | char *const envp[], struct task_struct *task); | ||
373 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | ||
374 | { | ||
375 | return __execve(filename, argv, envp, current); | ||
376 | } | ||
377 | |||
378 | unsigned long | ||
372 | get_wchan(struct task_struct *p) | 379 | get_wchan(struct task_struct *p) |
373 | { | 380 | { |
374 | struct unwind_frame_info info; | 381 | struct unwind_frame_info info; |
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S index 58758d883361..88fd73fdf048 100644 --- a/arch/powerpc/kernel/misc_32.S +++ b/arch/powerpc/kernel/misc_32.S | |||
@@ -843,7 +843,7 @@ _GLOBAL(kernel_thread) | |||
843 | addi r1,r1,16 | 843 | addi r1,r1,16 |
844 | blr | 844 | blr |
845 | 845 | ||
846 | _GLOBAL(execve) | 846 | _GLOBAL(kernel_execve) |
847 | li r0,__NR_execve | 847 | li r0,__NR_execve |
848 | sc | 848 | sc |
849 | bnslr | 849 | bnslr |
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index e3ed21cd3d94..9c54eccad993 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S | |||
@@ -556,7 +556,7 @@ _GLOBAL(giveup_altivec) | |||
556 | 556 | ||
557 | #endif /* CONFIG_ALTIVEC */ | 557 | #endif /* CONFIG_ALTIVEC */ |
558 | 558 | ||
559 | _GLOBAL(execve) | 559 | _GLOBAL(kernel_execve) |
560 | li r0,__NR_execve | 560 | li r0,__NR_execve |
561 | sc | 561 | sc |
562 | bnslr | 562 | bnslr |
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index abf14aaf905f..f5ed8624648b 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -164,3 +164,16 @@ int next_syscall_index(int limit) | |||
164 | spin_unlock(&syscall_lock); | 164 | spin_unlock(&syscall_lock); |
165 | return(ret); | 165 | return(ret); |
166 | } | 166 | } |
167 | |||
168 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | ||
169 | { | ||
170 | mm_segment_t fs; | ||
171 | int ret; | ||
172 | |||
173 | fs = get_fs(); | ||
174 | set_fs(KERNEL_DS); | ||
175 | ret = um_execve(filename, argv, envp); | ||
176 | set_fs(fs); | ||
177 | |||
178 | return ret; | ||
179 | } | ||
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index 2802524104f3..b8285cf1a9c3 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S | |||
@@ -1023,7 +1023,7 @@ ENDPROC(child_rip) | |||
1023 | * do_sys_execve asm fallback arguments: | 1023 | * do_sys_execve asm fallback arguments: |
1024 | * rdi: name, rsi: argv, rdx: envp, fake frame on the stack | 1024 | * rdi: name, rsi: argv, rdx: envp, fake frame on the stack |
1025 | */ | 1025 | */ |
1026 | ENTRY(execve) | 1026 | ENTRY(kernel_execve) |
1027 | CFI_STARTPROC | 1027 | CFI_STARTPROC |
1028 | FAKE_STACK_FRAME $0 | 1028 | FAKE_STACK_FRAME $0 |
1029 | SAVE_ALL | 1029 | SAVE_ALL |
@@ -1036,7 +1036,7 @@ ENTRY(execve) | |||
1036 | UNFAKE_STACK_FRAME | 1036 | UNFAKE_STACK_FRAME |
1037 | ret | 1037 | ret |
1038 | CFI_ENDPROC | 1038 | CFI_ENDPROC |
1039 | ENDPROC(execve) | 1039 | ENDPROC(kernel_execve) |
1040 | 1040 | ||
1041 | KPROBE_ENTRY(page_fault) | 1041 | KPROBE_ENTRY(page_fault) |
1042 | errorentry do_page_fault | 1042 | errorentry do_page_fault |
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c index 1cc706e11119..d27e4f6d7045 100644 --- a/drivers/sbus/char/bbc_envctrl.c +++ b/drivers/sbus/char/bbc_envctrl.c | |||
@@ -4,9 +4,6 @@ | |||
4 | * Copyright (C) 2001 David S. Miller (davem@redhat.com) | 4 | * Copyright (C) 2001 David S. Miller (davem@redhat.com) |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #define __KERNEL_SYSCALLS__ | ||
8 | static int errno; | ||
9 | |||
10 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
11 | #include <linux/kthread.h> | 8 | #include <linux/kthread.h> |
12 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
@@ -200,7 +197,7 @@ static void do_envctrl_shutdown(struct bbc_cpu_temperature *tp) | |||
200 | printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n"); | 197 | printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n"); |
201 | 198 | ||
202 | shutting_down = 1; | 199 | shutting_down = 1; |
203 | if (execve("/sbin/shutdown", argv, envp) < 0) | 200 | if (kernel_execve("/sbin/shutdown", argv, envp) < 0) |
204 | printk(KERN_CRIT "envctrl: shutdown execution failed\n"); | 201 | printk(KERN_CRIT "envctrl: shutdown execution failed\n"); |
205 | } | 202 | } |
206 | 203 | ||
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index 063e676a3ac0..728a133d0fc5 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c | |||
@@ -19,9 +19,6 @@ | |||
19 | * Daniele Bellucci <bellucda@tiscali.it> | 19 | * Daniele Bellucci <bellucda@tiscali.it> |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define __KERNEL_SYSCALLS__ | ||
23 | static int errno; | ||
24 | |||
25 | #include <linux/module.h> | 22 | #include <linux/module.h> |
26 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
27 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
@@ -976,13 +973,15 @@ static void envctrl_do_shutdown(void) | |||
976 | "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; | 973 | "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; |
977 | char *argv[] = { | 974 | char *argv[] = { |
978 | "/sbin/shutdown", "-h", "now", NULL }; | 975 | "/sbin/shutdown", "-h", "now", NULL }; |
976 | int ret; | ||
979 | 977 | ||
980 | if (inprog != 0) | 978 | if (inprog != 0) |
981 | return; | 979 | return; |
982 | 980 | ||
983 | inprog = 1; | 981 | inprog = 1; |
984 | printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n"); | 982 | printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n"); |
985 | if (0 > execve("/sbin/shutdown", argv, envp)) { | 983 | ret = kernel_execve("/sbin/shutdown", argv, envp); |
984 | if (ret < 0) { | ||
986 | printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n"); | 985 | printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n"); |
987 | inprog = 0; /* unlikely to succeed, but we could try again */ | 986 | inprog = 0; /* unlikely to succeed, but we could try again */ |
988 | } | 987 | } |
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index bc6e6a9259dc..2cabbd465c0c 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h | |||
@@ -580,75 +580,6 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6)\ | |||
580 | #define __ARCH_WANT_SYS_OLDUMOUNT | 580 | #define __ARCH_WANT_SYS_OLDUMOUNT |
581 | #define __ARCH_WANT_SYS_SIGPENDING | 581 | #define __ARCH_WANT_SYS_SIGPENDING |
582 | 582 | ||
583 | #ifdef __KERNEL_SYSCALLS__ | ||
584 | |||
585 | #include <linux/compiler.h> | ||
586 | #include <linux/types.h> | ||
587 | #include <linux/string.h> | ||
588 | #include <linux/signal.h> | ||
589 | #include <linux/syscalls.h> | ||
590 | #include <asm/ptrace.h> | ||
591 | |||
592 | static inline long open(const char * name, int mode, int flags) | ||
593 | { | ||
594 | return sys_open(name, mode, flags); | ||
595 | } | ||
596 | |||
597 | static inline long dup(int fd) | ||
598 | { | ||
599 | return sys_dup(fd); | ||
600 | } | ||
601 | |||
602 | static inline long close(int fd) | ||
603 | { | ||
604 | return sys_close(fd); | ||
605 | } | ||
606 | |||
607 | static inline off_t lseek(int fd, off_t off, int whence) | ||
608 | { | ||
609 | return sys_lseek(fd, off, whence); | ||
610 | } | ||
611 | |||
612 | static inline void _exit(int value) | ||
613 | { | ||
614 | sys_exit(value); | ||
615 | } | ||
616 | |||
617 | #define exit(x) _exit(x) | ||
618 | |||
619 | static inline long write(int fd, const char * buf, size_t nr) | ||
620 | { | ||
621 | return sys_write(fd, buf, nr); | ||
622 | } | ||
623 | |||
624 | static inline long read(int fd, char * buf, size_t nr) | ||
625 | { | ||
626 | return sys_read(fd, buf, nr); | ||
627 | } | ||
628 | |||
629 | extern int execve(char *, char **, char **); | ||
630 | |||
631 | static inline long setsid(void) | ||
632 | { | ||
633 | return sys_setsid(); | ||
634 | } | ||
635 | |||
636 | static inline pid_t waitpid(int pid, int * wait_stat, int flags) | ||
637 | { | ||
638 | return sys_wait4(pid, wait_stat, flags, NULL); | ||
639 | } | ||
640 | |||
641 | asmlinkage int sys_execve(char *ufilename, char **argv, char **envp, | ||
642 | unsigned long a3, unsigned long a4, unsigned long a5, | ||
643 | struct pt_regs regs); | ||
644 | asmlinkage long sys_rt_sigaction(int sig, | ||
645 | const struct sigaction __user *act, | ||
646 | struct sigaction __user *oact, | ||
647 | size_t sigsetsize, | ||
648 | void *restorer); | ||
649 | |||
650 | #endif /* __KERNEL_SYSCALLS__ */ | ||
651 | |||
652 | /* "Conditional" syscalls. What we want is | 583 | /* "Conditional" syscalls. What we want is |
653 | 584 | ||
654 | __attribute__((weak,alias("sys_ni_syscall"))) | 585 | __attribute__((weak,alias("sys_ni_syscall"))) |
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 2ab4078334bf..14a87eec5a2d 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h | |||
@@ -549,30 +549,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 | |||
549 | #define __ARCH_WANT_SYS_SOCKETCALL | 549 | #define __ARCH_WANT_SYS_SOCKETCALL |
550 | #endif | 550 | #endif |
551 | 551 | ||
552 | #ifdef __KERNEL_SYSCALLS__ | ||
553 | |||
554 | #include <linux/compiler.h> | ||
555 | #include <linux/types.h> | ||
556 | #include <linux/syscalls.h> | ||
557 | |||
558 | extern long execve(const char *file, char **argv, char **envp); | ||
559 | |||
560 | struct pt_regs; | ||
561 | asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, | ||
562 | struct pt_regs *regs); | ||
563 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
564 | struct pt_regs *regs); | ||
565 | asmlinkage int sys_fork(struct pt_regs *regs); | ||
566 | asmlinkage int sys_vfork(struct pt_regs *regs); | ||
567 | asmlinkage int sys_pipe(unsigned long *fildes); | ||
568 | struct sigaction; | ||
569 | asmlinkage long sys_rt_sigaction(int sig, | ||
570 | const struct sigaction __user *act, | ||
571 | struct sigaction __user *oact, | ||
572 | size_t sigsetsize); | ||
573 | |||
574 | #endif /* __KERNEL_SYSCALLS__ */ | ||
575 | |||
576 | /* | 552 | /* |
577 | * "Conditional" syscalls | 553 | * "Conditional" syscalls |
578 | * | 554 | * |
diff --git a/include/asm-arm26/unistd.h b/include/asm-arm26/unistd.h index c6d2436c9d34..25a5eead85be 100644 --- a/include/asm-arm26/unistd.h +++ b/include/asm-arm26/unistd.h | |||
@@ -464,30 +464,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 | |||
464 | #define __ARCH_WANT_SYS_SIGPROCMASK | 464 | #define __ARCH_WANT_SYS_SIGPROCMASK |
465 | #define __ARCH_WANT_SYS_RT_SIGACTION | 465 | #define __ARCH_WANT_SYS_RT_SIGACTION |
466 | 466 | ||
467 | #ifdef __KERNEL_SYSCALLS__ | ||
468 | |||
469 | #include <linux/compiler.h> | ||
470 | #include <linux/types.h> | ||
471 | #include <linux/syscalls.h> | ||
472 | |||
473 | extern long execve(const char *file, char **argv, char **envp); | ||
474 | |||
475 | struct pt_regs; | ||
476 | asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, | ||
477 | struct pt_regs *regs); | ||
478 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
479 | struct pt_regs *regs); | ||
480 | asmlinkage int sys_fork(struct pt_regs *regs); | ||
481 | asmlinkage int sys_vfork(struct pt_regs *regs); | ||
482 | asmlinkage int sys_pipe(unsigned long *fildes); | ||
483 | struct sigaction; | ||
484 | asmlinkage long sys_rt_sigaction(int sig, | ||
485 | const struct sigaction __user *act, | ||
486 | struct sigaction __user *oact, | ||
487 | size_t sigsetsize); | ||
488 | |||
489 | #endif /* __KERNEL_SYSCALLS__ */ | ||
490 | |||
491 | /* | 467 | /* |
492 | * "Conditional" syscalls | 468 | * "Conditional" syscalls |
493 | * | 469 | * |
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index bb0eb727dcd0..53c5c0ee122c 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h | |||
@@ -319,78 +319,6 @@ | |||
319 | 319 | ||
320 | extern long __ia64_syscall (long a0, long a1, long a2, long a3, long a4, long nr); | 320 | extern long __ia64_syscall (long a0, long a1, long a2, long a3, long a4, long nr); |
321 | 321 | ||
322 | #ifdef __KERNEL_SYSCALLS__ | ||
323 | |||
324 | #include <linux/compiler.h> | ||
325 | #include <linux/string.h> | ||
326 | #include <linux/signal.h> | ||
327 | #include <asm/ptrace.h> | ||
328 | #include <linux/stringify.h> | ||
329 | #include <linux/syscalls.h> | ||
330 | |||
331 | static inline long | ||
332 | open (const char * name, int mode, int flags) | ||
333 | { | ||
334 | return sys_open(name, mode, flags); | ||
335 | } | ||
336 | |||
337 | static inline long | ||
338 | dup (int fd) | ||
339 | { | ||
340 | return sys_dup(fd); | ||
341 | } | ||
342 | |||
343 | static inline long | ||
344 | close (int fd) | ||
345 | { | ||
346 | return sys_close(fd); | ||
347 | } | ||
348 | |||
349 | static inline off_t | ||
350 | lseek (int fd, off_t off, int whence) | ||
351 | { | ||
352 | return sys_lseek(fd, off, whence); | ||
353 | } | ||
354 | |||
355 | static inline void | ||
356 | _exit (int value) | ||
357 | { | ||
358 | sys_exit(value); | ||
359 | } | ||
360 | |||
361 | #define exit(x) _exit(x) | ||
362 | |||
363 | static inline long | ||
364 | write (int fd, const char * buf, size_t nr) | ||
365 | { | ||
366 | return sys_write(fd, buf, nr); | ||
367 | } | ||
368 | |||
369 | static inline long | ||
370 | read (int fd, char * buf, size_t nr) | ||
371 | { | ||
372 | return sys_read(fd, buf, nr); | ||
373 | } | ||
374 | |||
375 | |||
376 | static inline long | ||
377 | setsid (void) | ||
378 | { | ||
379 | return sys_setsid(); | ||
380 | } | ||
381 | |||
382 | static inline pid_t | ||
383 | waitpid (int pid, int * wait_stat, int flags) | ||
384 | { | ||
385 | return sys_wait4(pid, wait_stat, flags, NULL); | ||
386 | } | ||
387 | |||
388 | |||
389 | extern int execve (const char *filename, char *const av[], char *const ep[]); | ||
390 | extern pid_t clone (unsigned long flags, void *sp); | ||
391 | |||
392 | #endif /* __KERNEL_SYSCALLS__ */ | ||
393 | |||
394 | asmlinkage unsigned long sys_mmap( | 322 | asmlinkage unsigned long sys_mmap( |
395 | unsigned long addr, unsigned long len, | 323 | unsigned long addr, unsigned long len, |
396 | int prot, int flags, | 324 | int prot, int flags, |
diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h index 27bcfad1c3e3..53b0f5d290e4 100644 --- a/include/asm-parisc/unistd.h +++ b/include/asm-parisc/unistd.h | |||
@@ -952,92 +952,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ | |||
952 | #define __ARCH_WANT_SYS_SIGPROCMASK | 952 | #define __ARCH_WANT_SYS_SIGPROCMASK |
953 | #define __ARCH_WANT_SYS_RT_SIGACTION | 953 | #define __ARCH_WANT_SYS_RT_SIGACTION |
954 | 954 | ||
955 | /* mmap & mmap2 take 6 arguments */ | ||
956 | #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ | ||
957 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ | ||
958 | { \ | ||
959 | return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \ | ||
960 | } | ||
961 | |||
962 | #ifdef __KERNEL_SYSCALLS__ | ||
963 | |||
964 | #include <asm/current.h> | ||
965 | #include <linux/compiler.h> | ||
966 | #include <linux/types.h> | ||
967 | #include <linux/syscalls.h> | ||
968 | |||
969 | static inline pid_t setsid(void) | ||
970 | { | ||
971 | return sys_setsid(); | ||
972 | } | ||
973 | |||
974 | static inline int write(int fd, const char *buf, off_t count) | ||
975 | { | ||
976 | return sys_write(fd, buf, count); | ||
977 | } | ||
978 | |||
979 | static inline int read(int fd, char *buf, off_t count) | ||
980 | { | ||
981 | return sys_read(fd, buf, count); | ||
982 | } | ||
983 | |||
984 | static inline off_t lseek(int fd, off_t offset, int count) | ||
985 | { | ||
986 | return sys_lseek(fd, offset, count); | ||
987 | } | ||
988 | |||
989 | static inline int dup(int fd) | ||
990 | { | ||
991 | return sys_dup(fd); | ||
992 | } | ||
993 | |||
994 | static inline int execve(char *filename, char * argv [], | ||
995 | char * envp[]) | ||
996 | { | ||
997 | extern int __execve(char *, char **, char **, struct task_struct *); | ||
998 | return __execve(filename, argv, envp, current); | ||
999 | } | ||
1000 | |||
1001 | static inline int open(const char *file, int flag, int mode) | ||
1002 | { | ||
1003 | return sys_open(file, flag, mode); | ||
1004 | } | ||
1005 | |||
1006 | static inline int close(int fd) | ||
1007 | { | ||
1008 | return sys_close(fd); | ||
1009 | } | ||
1010 | |||
1011 | static inline void _exit(int exitcode) | ||
1012 | { | ||
1013 | sys_exit(exitcode); | ||
1014 | } | ||
1015 | |||
1016 | static inline pid_t waitpid(pid_t pid, int *wait_stat, int options) | ||
1017 | { | ||
1018 | return sys_wait4(pid, wait_stat, options, NULL); | ||
1019 | } | ||
1020 | |||
1021 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | ||
1022 | unsigned long prot, unsigned long flags, | ||
1023 | unsigned long fd, unsigned long offset); | ||
1024 | asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, | ||
1025 | unsigned long prot, unsigned long flags, | ||
1026 | unsigned long fd, unsigned long pgoff); | ||
1027 | struct pt_regs; | ||
1028 | asmlinkage int sys_execve(struct pt_regs *regs); | ||
1029 | int sys_clone(unsigned long clone_flags, unsigned long usp, | ||
1030 | struct pt_regs *regs); | ||
1031 | int sys_vfork(struct pt_regs *regs); | ||
1032 | int sys_pipe(int *fildes); | ||
1033 | struct sigaction; | ||
1034 | asmlinkage long sys_rt_sigaction(int sig, | ||
1035 | const struct sigaction __user *act, | ||
1036 | struct sigaction __user *oact, | ||
1037 | size_t sigsetsize); | ||
1038 | |||
1039 | #endif /* __KERNEL_SYSCALLS__ */ | ||
1040 | |||
1041 | #endif /* __ASSEMBLY__ */ | 955 | #endif /* __ASSEMBLY__ */ |
1042 | 956 | ||
1043 | #undef STR | 957 | #undef STR |
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h index eb66eae6616f..464a48cce7f5 100644 --- a/include/asm-powerpc/unistd.h +++ b/include/asm-powerpc/unistd.h | |||
@@ -479,13 +479,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6 | |||
479 | #endif | 479 | #endif |
480 | 480 | ||
481 | /* | 481 | /* |
482 | * System call prototypes. | ||
483 | */ | ||
484 | #ifdef __KERNEL_SYSCALLS__ | ||
485 | extern int execve(const char *file, char **argv, char **envp); | ||
486 | #endif /* __KERNEL_SYSCALLS__ */ | ||
487 | |||
488 | /* | ||
489 | * "Conditional" syscalls | 482 | * "Conditional" syscalls |
490 | * | 483 | * |
491 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | 484 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), |
diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h index afccfcaa9ea9..732c83f04c3d 100644 --- a/include/asm-um/unistd.h +++ b/include/asm-um/unistd.h | |||
@@ -37,34 +37,6 @@ extern int um_execve(const char *file, char *const argv[], char *const env[]); | |||
37 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 37 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #ifdef __KERNEL_SYSCALLS__ | ||
41 | |||
42 | #include <linux/compiler.h> | ||
43 | #include <linux/types.h> | ||
44 | |||
45 | static inline int execve(const char *filename, char *const argv[], | ||
46 | char *const envp[]) | ||
47 | { | ||
48 | mm_segment_t fs; | ||
49 | int ret; | ||
50 | |||
51 | fs = get_fs(); | ||
52 | set_fs(KERNEL_DS); | ||
53 | ret = um_execve(filename, argv, envp); | ||
54 | set_fs(fs); | ||
55 | |||
56 | if (ret >= 0) | ||
57 | return ret; | ||
58 | |||
59 | errno = -(long)ret; | ||
60 | return -1; | ||
61 | } | ||
62 | |||
63 | int sys_execve(char *file, char **argv, char **env); | ||
64 | |||
65 | #endif /* __KERNEL_SYSCALLS__ */ | ||
66 | |||
67 | #undef __KERNEL_SYSCALLS__ | ||
68 | #include "asm/arch/unistd.h" | 40 | #include "asm/arch/unistd.h" |
69 | 41 | ||
70 | #endif /* _UM_UNISTD_H_*/ | 42 | #endif /* _UM_UNISTD_H_*/ |
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 6137146516d3..777288eb7e75 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h | |||
@@ -620,10 +620,11 @@ __SYSCALL(__NR_vmsplice, sys_vmsplice) | |||
620 | #define __NR_move_pages 279 | 620 | #define __NR_move_pages 279 |
621 | __SYSCALL(__NR_move_pages, sys_move_pages) | 621 | __SYSCALL(__NR_move_pages, sys_move_pages) |
622 | 622 | ||
623 | #ifdef __KERNEL__ | ||
624 | |||
625 | #define __NR_syscall_max __NR_move_pages | 623 | #define __NR_syscall_max __NR_move_pages |
624 | |||
625 | #ifdef __KERNEL__ | ||
626 | #include <linux/err.h> | 626 | #include <linux/err.h> |
627 | #endif | ||
627 | 628 | ||
628 | #ifndef __NO_STUBS | 629 | #ifndef __NO_STUBS |
629 | 630 | ||
@@ -663,8 +664,6 @@ do { \ | |||
663 | #define __ARCH_WANT_SYS_TIME | 664 | #define __ARCH_WANT_SYS_TIME |
664 | #define __ARCH_WANT_COMPAT_SYS_TIME | 665 | #define __ARCH_WANT_COMPAT_SYS_TIME |
665 | 666 | ||
666 | #ifndef __KERNEL_SYSCALLS__ | ||
667 | |||
668 | #define __syscall "syscall" | 667 | #define __syscall "syscall" |
669 | 668 | ||
670 | #define _syscall0(type,name) \ | 669 | #define _syscall0(type,name) \ |
@@ -746,83 +745,7 @@ __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; " __syscall \ | |||
746 | __syscall_return(type,__res); \ | 745 | __syscall_return(type,__res); \ |
747 | } | 746 | } |
748 | 747 | ||
749 | #else /* __KERNEL_SYSCALLS__ */ | 748 | #ifdef __KERNEL__ |
750 | |||
751 | #include <linux/syscalls.h> | ||
752 | #include <asm/ptrace.h> | ||
753 | |||
754 | /* | ||
755 | * we need this inline - forking from kernel space will result | ||
756 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
757 | * is no problem, but for the stack. This is handled by not letting | ||
758 | * main() use the stack at all after fork(). Thus, no function | ||
759 | * calls - which means inline code for fork too, as otherwise we | ||
760 | * would use the stack upon exit from 'fork()'. | ||
761 | * | ||
762 | * Actually only pause and fork are needed inline, so that there | ||
763 | * won't be any messing with the stack from main(), but we define | ||
764 | * some others too. | ||
765 | */ | ||
766 | #define __NR__exit __NR_exit | ||
767 | |||
768 | static inline pid_t setsid(void) | ||
769 | { | ||
770 | return sys_setsid(); | ||
771 | } | ||
772 | |||
773 | static inline ssize_t write(unsigned int fd, char * buf, size_t count) | ||
774 | { | ||
775 | return sys_write(fd, buf, count); | ||
776 | } | ||
777 | |||
778 | static inline ssize_t read(unsigned int fd, char * buf, size_t count) | ||
779 | { | ||
780 | return sys_read(fd, buf, count); | ||
781 | } | ||
782 | |||
783 | static inline off_t lseek(unsigned int fd, off_t offset, unsigned int origin) | ||
784 | { | ||
785 | return sys_lseek(fd, offset, origin); | ||
786 | } | ||
787 | |||
788 | static inline long dup(unsigned int fd) | ||
789 | { | ||
790 | return sys_dup(fd); | ||
791 | } | ||
792 | |||
793 | /* implemented in asm in arch/x86_64/kernel/entry.S */ | ||
794 | extern int execve(const char *, char * const *, char * const *); | ||
795 | |||
796 | static inline long open(const char * filename, int flags, int mode) | ||
797 | { | ||
798 | return sys_open(filename, flags, mode); | ||
799 | } | ||
800 | |||
801 | static inline long close(unsigned int fd) | ||
802 | { | ||
803 | return sys_close(fd); | ||
804 | } | ||
805 | |||
806 | static inline pid_t waitpid(int pid, int * wait_stat, int flags) | ||
807 | { | ||
808 | return sys_wait4(pid, wait_stat, flags, NULL); | ||
809 | } | ||
810 | |||
811 | extern long sys_mmap(unsigned long addr, unsigned long len, | ||
812 | unsigned long prot, unsigned long flags, | ||
813 | unsigned long fd, unsigned long off); | ||
814 | |||
815 | extern int sys_modify_ldt(int func, void *ptr, unsigned long bytecount); | ||
816 | |||
817 | asmlinkage long sys_execve(char *name, char **argv, char **envp, | ||
818 | struct pt_regs regs); | ||
819 | asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
820 | void *parent_tid, void *child_tid, | ||
821 | struct pt_regs regs); | ||
822 | asmlinkage long sys_fork(struct pt_regs regs); | ||
823 | asmlinkage long sys_vfork(struct pt_regs regs); | ||
824 | asmlinkage long sys_pipe(int *fildes); | ||
825 | |||
826 | #ifndef __ASSEMBLY__ | 749 | #ifndef __ASSEMBLY__ |
827 | 750 | ||
828 | #include <linux/linkage.h> | 751 | #include <linux/linkage.h> |
@@ -839,8 +762,8 @@ asmlinkage long sys_rt_sigaction(int sig, | |||
839 | size_t sigsetsize); | 762 | size_t sigsetsize); |
840 | 763 | ||
841 | #endif /* __ASSEMBLY__ */ | 764 | #endif /* __ASSEMBLY__ */ |
842 | 765 | #endif /* __KERNEL__ */ | |
843 | #endif /* __KERNEL_SYSCALLS__ */ | 766 | #endif /* __NO_STUBS */ |
844 | 767 | ||
845 | /* | 768 | /* |
846 | * "Conditional" syscalls | 769 | * "Conditional" syscalls |
@@ -850,8 +773,4 @@ asmlinkage long sys_rt_sigaction(int sig, | |||
850 | */ | 773 | */ |
851 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | 774 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") |
852 | 775 | ||
853 | #endif /* __NO_STUBS */ | ||
854 | |||
855 | #endif /* __KERNEL__ */ | ||
856 | |||
857 | #endif /* _ASM_X86_64_UNISTD_H_ */ | 776 | #endif /* _ASM_X86_64_UNISTD_H_ */ |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 2d1c3d5c83ac..3efcfc7e9c6c 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -599,4 +599,6 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, | |||
599 | size_t len); | 599 | size_t len); |
600 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); | 600 | asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache); |
601 | 601 | ||
602 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); | ||
603 | |||
602 | #endif | 604 | #endif |