Commit 3db03b4afb3ecd66a0399b8ba57742ca953b0ecd
Committed by
Linus Torvalds
1 parent
6760856791
[PATCH] rename the provided execve functions to kernel_execve
Some architectures provide an execve function that does not set errno, but instead returns the result code directly. Rename these to kernel_execve to get the right semantics there. Moreover, there is no reasone for any of these architectures to still provide __KERNEL_SYSCALLS__ or _syscallN macros, so remove these right away. [akpm@osdl.org: build fix] [bunk@stusta.de: build fix] Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Andi Kleen <ak@muc.de> Acked-by: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Ian Molton <spyro@f2s.com> Cc: Mikael Starvik <starvik@axis.com> Cc: David Howells <dhowells@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Hirokazu Takata <takata.hirokazu@renesas.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp> Cc: Richard Curnow <rc@rc0.org.uk> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp> Cc: Chris Zankel <chris@zankel.net> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Adrian Bunk <bunk@stusta.de> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 21 changed files with 49 additions and 423 deletions Side-by-side Diff
- arch/alpha/kernel/alpha_ksyms.c
- arch/alpha/kernel/entry.S
- arch/arm/kernel/sys_arm.c
- arch/arm26/kernel/sys_arm.c
- arch/ia64/kernel/entry.S
- arch/parisc/kernel/process.c
- arch/powerpc/kernel/misc_32.S
- arch/powerpc/kernel/misc_64.S
- arch/um/kernel/syscall.c
- arch/x86_64/kernel/entry.S
- drivers/sbus/char/bbc_envctrl.c
- drivers/sbus/char/envctrl.c
- include/asm-alpha/unistd.h
- include/asm-arm/unistd.h
- include/asm-arm26/unistd.h
- include/asm-ia64/unistd.h
- include/asm-parisc/unistd.h
- include/asm-powerpc/unistd.h
- include/asm-um/unistd.h
- include/asm-x86_64/unistd.h
- include/linux/syscalls.h
arch/alpha/kernel/alpha_ksyms.c
... | ... | @@ -36,7 +36,6 @@ |
36 | 36 | #include <asm/cacheflush.h> |
37 | 37 | #include <asm/vga.h> |
38 | 38 | |
39 | -#define __KERNEL_SYSCALLS__ | |
40 | 39 | #include <asm/unistd.h> |
41 | 40 | |
42 | 41 | extern struct hwrpb_struct *hwrpb; |
... | ... | @@ -116,7 +115,7 @@ |
116 | 115 | EXPORT_SYMBOL(sys_exit); |
117 | 116 | EXPORT_SYMBOL(sys_write); |
118 | 117 | EXPORT_SYMBOL(sys_lseek); |
119 | -EXPORT_SYMBOL(execve); | |
118 | +EXPORT_SYMBOL(kernel_execve); | |
120 | 119 | EXPORT_SYMBOL(sys_setsid); |
121 | 120 | EXPORT_SYMBOL(sys_wait4); |
122 | 121 |
arch/alpha/kernel/entry.S
... | ... | @@ -655,12 +655,12 @@ |
655 | 655 | .end kernel_thread |
656 | 656 | |
657 | 657 | /* |
658 | - * execve(path, argv, envp) | |
658 | + * kernel_execve(path, argv, envp) | |
659 | 659 | */ |
660 | 660 | .align 4 |
661 | - .globl execve | |
662 | - .ent execve | |
663 | -execve: | |
661 | + .globl kernel_execve | |
662 | + .ent kernel_execve | |
663 | +kernel_execve: | |
664 | 664 | /* We can be called from a module. */ |
665 | 665 | ldgp $gp, 0($27) |
666 | 666 | lda $sp, -(32+SIZEOF_PT_REGS+8)($sp) |
... | ... | @@ -704,7 +704,7 @@ |
704 | 704 | |
705 | 705 | 1: lda $sp, 32+SIZEOF_PT_REGS+8($sp) |
706 | 706 | ret |
707 | -.end execve | |
707 | +.end kernel_execve | |
708 | 708 | |
709 | 709 | |
710 | 710 | /* |
arch/arm/kernel/sys_arm.c
... | ... | @@ -279,7 +279,7 @@ |
279 | 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 | 284 | struct pt_regs regs; |
285 | 285 | int ret; |
... | ... | @@ -317,7 +317,7 @@ |
317 | 317 | out: |
318 | 318 | return ret; |
319 | 319 | } |
320 | -EXPORT_SYMBOL(execve); | |
320 | +EXPORT_SYMBOL(kernel_execve); | |
321 | 321 | |
322 | 322 | /* |
323 | 323 | * Since loff_t is a 64 bit type we avoid a lot of ABI hastle |
arch/arm26/kernel/sys_arm.c
... | ... | @@ -283,7 +283,7 @@ |
283 | 283 | } |
284 | 284 | |
285 | 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 | 288 | struct pt_regs regs; |
289 | 289 | int ret; |
... | ... | @@ -320,5 +320,5 @@ |
320 | 320 | return ret; |
321 | 321 | } |
322 | 322 | |
323 | -EXPORT_SYMBOL(execve); | |
323 | +EXPORT_SYMBOL(kernel_execve); |
arch/ia64/kernel/entry.S
... | ... | @@ -492,11 +492,11 @@ |
492 | 492 | br.ret.sptk.many rp |
493 | 493 | END(prefetch_stack) |
494 | 494 | |
495 | -GLOBAL_ENTRY(execve) | |
495 | +GLOBAL_ENTRY(kernel_execve) | |
496 | 496 | mov r15=__NR_execve // put syscall number in place |
497 | 497 | break __BREAK_SYSCALL |
498 | 498 | br.ret.sptk.many rp |
499 | -END(execve) | |
499 | +END(kernel_execve) | |
500 | 500 | |
501 | 501 | GLOBAL_ENTRY(clone) |
502 | 502 | mov r15=__NR_clone // put syscall number in place |
arch/parisc/kernel/process.c
... | ... | @@ -368,7 +368,14 @@ |
368 | 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 | 379 | get_wchan(struct task_struct *p) |
373 | 380 | { |
374 | 381 | struct unwind_frame_info info; |
arch/powerpc/kernel/misc_32.S
arch/powerpc/kernel/misc_64.S
arch/um/kernel/syscall.c
... | ... | @@ -164,4 +164,17 @@ |
164 | 164 | spin_unlock(&syscall_lock); |
165 | 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 | +} |
arch/x86_64/kernel/entry.S
... | ... | @@ -1023,7 +1023,7 @@ |
1023 | 1023 | * do_sys_execve asm fallback arguments: |
1024 | 1024 | * rdi: name, rsi: argv, rdx: envp, fake frame on the stack |
1025 | 1025 | */ |
1026 | -ENTRY(execve) | |
1026 | +ENTRY(kernel_execve) | |
1027 | 1027 | CFI_STARTPROC |
1028 | 1028 | FAKE_STACK_FRAME $0 |
1029 | 1029 | SAVE_ALL |
... | ... | @@ -1036,7 +1036,7 @@ |
1036 | 1036 | UNFAKE_STACK_FRAME |
1037 | 1037 | ret |
1038 | 1038 | CFI_ENDPROC |
1039 | -ENDPROC(execve) | |
1039 | +ENDPROC(kernel_execve) | |
1040 | 1040 | |
1041 | 1041 | KPROBE_ENTRY(page_fault) |
1042 | 1042 | errorentry do_page_fault |
drivers/sbus/char/bbc_envctrl.c
... | ... | @@ -4,9 +4,6 @@ |
4 | 4 | * Copyright (C) 2001 David S. Miller (davem@redhat.com) |
5 | 5 | */ |
6 | 6 | |
7 | -#define __KERNEL_SYSCALLS__ | |
8 | -static int errno; | |
9 | - | |
10 | 7 | #include <linux/kernel.h> |
11 | 8 | #include <linux/kthread.h> |
12 | 9 | #include <linux/sched.h> |
... | ... | @@ -200,7 +197,7 @@ |
200 | 197 | printk(KERN_CRIT "kenvctrld: Shutting down the system now.\n"); |
201 | 198 | |
202 | 199 | shutting_down = 1; |
203 | - if (execve("/sbin/shutdown", argv, envp) < 0) | |
200 | + if (kernel_execve("/sbin/shutdown", argv, envp) < 0) | |
204 | 201 | printk(KERN_CRIT "envctrl: shutdown execution failed\n"); |
205 | 202 | } |
206 | 203 |
drivers/sbus/char/envctrl.c
... | ... | @@ -19,9 +19,6 @@ |
19 | 19 | * Daniele Bellucci <bellucda@tiscali.it> |
20 | 20 | */ |
21 | 21 | |
22 | -#define __KERNEL_SYSCALLS__ | |
23 | -static int errno; | |
24 | - | |
25 | 22 | #include <linux/module.h> |
26 | 23 | #include <linux/sched.h> |
27 | 24 | #include <linux/kthread.h> |
28 | 25 | |
... | ... | @@ -976,13 +973,15 @@ |
976 | 973 | "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; |
977 | 974 | char *argv[] = { |
978 | 975 | "/sbin/shutdown", "-h", "now", NULL }; |
976 | + int ret; | |
979 | 977 | |
980 | 978 | if (inprog != 0) |
981 | 979 | return; |
982 | 980 | |
983 | 981 | inprog = 1; |
984 | 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 | 985 | printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n"); |
987 | 986 | inprog = 0; /* unlikely to succeed, but we could try again */ |
988 | 987 | } |
include/asm-alpha/unistd.h
... | ... | @@ -580,75 +580,6 @@ |
580 | 580 | #define __ARCH_WANT_SYS_OLDUMOUNT |
581 | 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 | 583 | /* "Conditional" syscalls. What we want is |
653 | 584 | |
654 | 585 | __attribute__((weak,alias("sys_ni_syscall"))) |
include/asm-arm/unistd.h
... | ... | @@ -549,30 +549,6 @@ |
549 | 549 | #define __ARCH_WANT_SYS_SOCKETCALL |
550 | 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 | 553 | * "Conditional" syscalls |
578 | 554 | * |
include/asm-arm26/unistd.h
... | ... | @@ -464,30 +464,6 @@ |
464 | 464 | #define __ARCH_WANT_SYS_SIGPROCMASK |
465 | 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 | 468 | * "Conditional" syscalls |
493 | 469 | * |
include/asm-ia64/unistd.h
... | ... | @@ -319,78 +319,6 @@ |
319 | 319 | |
320 | 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 | 322 | asmlinkage unsigned long sys_mmap( |
395 | 323 | unsigned long addr, unsigned long len, |
396 | 324 | int prot, int flags, |
include/asm-parisc/unistd.h
... | ... | @@ -952,92 +952,6 @@ |
952 | 952 | #define __ARCH_WANT_SYS_SIGPROCMASK |
953 | 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 | 955 | #endif /* __ASSEMBLY__ */ |
1042 | 956 | |
1043 | 957 | #undef STR |
include/asm-powerpc/unistd.h
... | ... | @@ -479,13 +479,6 @@ |
479 | 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 | 482 | * "Conditional" syscalls |
490 | 483 | * |
491 | 484 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), |
include/asm-um/unistd.h
... | ... | @@ -37,34 +37,6 @@ |
37 | 37 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
38 | 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 | 40 | #include "asm/arch/unistd.h" |
69 | 41 | |
70 | 42 | #endif /* _UM_UNISTD_H_*/ |
include/asm-x86_64/unistd.h
... | ... | @@ -620,10 +620,11 @@ |
620 | 620 | #define __NR_move_pages 279 |
621 | 621 | __SYSCALL(__NR_move_pages, sys_move_pages) |
622 | 622 | |
623 | -#ifdef __KERNEL__ | |
624 | - | |
625 | 623 | #define __NR_syscall_max __NR_move_pages |
624 | + | |
625 | +#ifdef __KERNEL__ | |
626 | 626 | #include <linux/err.h> |
627 | +#endif | |
627 | 628 | |
628 | 629 | #ifndef __NO_STUBS |
629 | 630 | |
... | ... | @@ -663,8 +664,6 @@ |
663 | 664 | #define __ARCH_WANT_SYS_TIME |
664 | 665 | #define __ARCH_WANT_COMPAT_SYS_TIME |
665 | 666 | |
666 | -#ifndef __KERNEL_SYSCALLS__ | |
667 | - | |
668 | 667 | #define __syscall "syscall" |
669 | 668 | |
670 | 669 | #define _syscall0(type,name) \ |
... | ... | @@ -746,83 +745,7 @@ |
746 | 745 | __syscall_return(type,__res); \ |
747 | 746 | } |
748 | 747 | |
749 | -#else /* __KERNEL_SYSCALLS__ */ | |
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 | - | |
748 | +#ifdef __KERNEL__ | |
826 | 749 | #ifndef __ASSEMBLY__ |
827 | 750 | |
828 | 751 | #include <linux/linkage.h> |
829 | 752 | |
... | ... | @@ -839,9 +762,9 @@ |
839 | 762 | size_t sigsetsize); |
840 | 763 | |
841 | 764 | #endif /* __ASSEMBLY__ */ |
765 | +#endif /* __KERNEL__ */ | |
766 | +#endif /* __NO_STUBS */ | |
842 | 767 | |
843 | -#endif /* __KERNEL_SYSCALLS__ */ | |
844 | - | |
845 | 768 | /* |
846 | 769 | * "Conditional" syscalls |
847 | 770 | * |
... | ... | @@ -849,10 +772,6 @@ |
849 | 772 | * but it doesn't work on all toolchains, so we just do it by hand |
850 | 773 | */ |
851 | 774 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") |
852 | - | |
853 | -#endif /* __NO_STUBS */ | |
854 | - | |
855 | -#endif /* __KERNEL__ */ | |
856 | 775 | |
857 | 776 | #endif /* _ASM_X86_64_UNISTD_H_ */ |
include/linux/syscalls.h