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

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