root/include/asm-alpha/unistd.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. fork
  2. idle
  3. setup
  4. open
  5. dup
  6. close
  7. _exit
  8. write
  9. read
  10. execve
  11. setsid
  12. sync
  13. waitpid
  14. wait

   1 #ifndef _ALPHA_UNISTD_H
   2 #define _ALPHA_UNISTD_H
   3 
   4 /*
   5  * ".long 131" is "PAL_callsys"..
   6  *
   7  * Duh, the alpha gcc compiler doesn't allow us to specify regs
   8  * yet. I'll have to see about this later..
   9  */
  10 
  11 #ifdef __LIBRARY__
  12 
  13 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
  14 #define _syscall0(type,name) \
  15 type name(void) \
  16 { \
  17         return (type) -1; \
  18 }
  19 
  20 #define _syscall1(type,name,type1,arg1) \
  21 type name(type1 arg1) \
  22 { \
  23         return (type) -1; \
  24 }
  25 
  26 #define _syscall2(type,name,type1,arg1,type2,arg2) \
  27 type name(type1 arg1,type2 arg2) \
  28 { \
  29         return (type) -1; \
  30 }
  31 
  32 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
  33 type name(type1 arg1,type2 arg2,type3 arg3) \
  34 { \
  35         return (type) -1; \
  36 }
  37 
  38 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  39 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  40 { \
  41         return (type) -1; \
  42 } 
  43 
  44 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
  45           type5,arg5) \
  46 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
  47 { \
  48         return (type) -1; \
  49 }
  50 
  51 #endif /* __LIBRARY__ */
  52 
  53 #ifdef __KERNEL_SYSCALLS__
  54 
  55 #include <linux/string.h>
  56 
  57 extern unsigned long kernel_fork(void);
  58 static inline unsigned long fork(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  59 {
  60         return kernel_fork();
  61 }
  62 
  63 extern void sys_idle(void);
  64 static inline void idle(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  65 {
  66         sys_idle();
  67 }
  68 
  69 extern int sys_setup(void);
  70 static inline int setup(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  71 {
  72         return sys_setup();
  73 }
  74 
  75 extern int sys_open(const char *, int, int);
  76 static inline int open(const char * name, int mode, int flags)
     /* [previous][next][first][last][top][bottom][index][help] */
  77 {
  78         return sys_open(name, mode, flags);
  79 }
  80 
  81 extern int sys_dup(int);
  82 static inline int dup(int fd)
     /* [previous][next][first][last][top][bottom][index][help] */
  83 {
  84         return sys_dup(fd);
  85 }
  86 
  87 static inline int close(int fd)
     /* [previous][next][first][last][top][bottom][index][help] */
  88 {
  89         return sys_close(fd);
  90 }
  91 
  92 extern int sys_exit(int);
  93 static inline int _exit(int value)
     /* [previous][next][first][last][top][bottom][index][help] */
  94 {
  95         return sys_exit(value);
  96 }
  97 
  98 #define exit(x) _exit(x)
  99 
 100 extern int sys_write(int, const char *, int);
 101 static inline int write(int fd, const char * buf, int nr)
     /* [previous][next][first][last][top][bottom][index][help] */
 102 {
 103         return sys_write(fd, buf, nr);
 104 }
 105 
 106 extern int sys_read(int, char *, int);
 107 static inline int read(int fd, char * buf, int nr)
     /* [previous][next][first][last][top][bottom][index][help] */
 108 {
 109         return sys_read(fd, buf, nr);
 110 }
 111 
 112 extern int do_execve(char *, char **, char **, struct pt_regs *);
 113 extern void ret_from_sys_call(void);
 114 static inline int execve(char * file, char ** argvp, char ** envp)
     /* [previous][next][first][last][top][bottom][index][help] */
 115 {
 116         int i;
 117         struct pt_regs regs;
 118 
 119         memset(&regs, 0, sizeof(regs));
 120         i = do_execve(file, argvp, envp, &regs);
 121         if (!i) {
 122                 __asm__ __volatile__("bis %0,%0,$30\n\t"
 123                                 "bis %1,%1,$26\n\t"
 124                                 "ret $31,($26),1\n\t"
 125                                 : :"r" (&regs), "r" (ret_from_sys_call));
 126         }
 127         return -1;
 128 }
 129 
 130 extern int sys_setsid(void);
 131 static inline int setsid(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 132 {
 133         return sys_setsid();
 134 }
 135 
 136 extern int sys_sync(void);
 137 static inline int sync(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 138 {
 139         return sys_sync();
 140 }
 141 
 142 extern int sys_waitpid(int, int *, int);
 143 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
     /* [previous][next][first][last][top][bottom][index][help] */
 144 {
 145         return sys_waitpid(pid,wait_stat,flags);
 146 }
 147 
 148 static inline pid_t wait(int * wait_stat)
     /* [previous][next][first][last][top][bottom][index][help] */
 149 {
 150         return waitpid(-1,wait_stat,0);
 151 }
 152 
 153 #endif
 154 
 155 #endif /* _ALPHA_UNISTD_H */

/* [previous][next][first][last][top][bottom][index][help] */