diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2006-10-02 05:18:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:23 -0400 |
| commit | 3db03b4afb3ecd66a0399b8ba57742ca953b0ecd (patch) | |
| tree | fe0bd5c3663c58583f0181e2673d569c2df664e7 /include | |
| parent | 6760856791c6e527da678021ee6a67896549d4da (diff) | |
[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>
Diffstat (limited to 'include')
| -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 |
9 files changed, 8 insertions, 397 deletions
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index bc6e6a9259..2cabbd465c 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 2ab4078334..14a87eec5a 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 c6d2436c9d..25a5eead85 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 bb0eb727dc..53c5c0ee12 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 27bcfad1c3..53b0f5d290 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 eb66eae661..464a48cce7 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 afccfcaa9e..732c83f04c 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 6137146516..777288eb7e 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 2d1c3d5c83..3efcfc7e9c 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 |
