aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64/unistd.h
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2006-10-02 05:18:31 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:23 -0400
commit3db03b4afb3ecd66a0399b8ba57742ca953b0ecd (patch)
treefe0bd5c3663c58583f0181e2673d569c2df664e7 /include/asm-x86_64/unistd.h
parent6760856791c6e527da678021ee6a67896549d4da (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/asm-x86_64/unistd.h')
-rw-r--r--include/asm-x86_64/unistd.h93
1 files changed, 6 insertions, 87 deletions
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
768static inline pid_t setsid(void)
769{
770 return sys_setsid();
771}
772
773static inline ssize_t write(unsigned int fd, char * buf, size_t count)
774{
775 return sys_write(fd, buf, count);
776}
777
778static inline ssize_t read(unsigned int fd, char * buf, size_t count)
779{
780 return sys_read(fd, buf, count);
781}
782
783static inline off_t lseek(unsigned int fd, off_t offset, unsigned int origin)
784{
785 return sys_lseek(fd, offset, origin);
786}
787
788static 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 */
794extern int execve(const char *, char * const *, char * const *);
795
796static inline long open(const char * filename, int flags, int mode)
797{
798 return sys_open(filename, flags, mode);
799}
800
801static inline long close(unsigned int fd)
802{
803 return sys_close(fd);
804}
805
806static inline pid_t waitpid(int pid, int * wait_stat, int flags)
807{
808 return sys_wait4(pid, wait_stat, flags, NULL);
809}
810
811extern long sys_mmap(unsigned long addr, unsigned long len,
812 unsigned long prot, unsigned long flags,
813 unsigned long fd, unsigned long off);
814
815extern int sys_modify_ldt(int func, void *ptr, unsigned long bytecount);
816
817asmlinkage long sys_execve(char *name, char **argv, char **envp,
818 struct pt_regs regs);
819asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
820 void *parent_tid, void *child_tid,
821 struct pt_regs regs);
822asmlinkage long sys_fork(struct pt_regs regs);
823asmlinkage long sys_vfork(struct pt_regs regs);
824asmlinkage 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_ */