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 #define __NR_exit                 1
  12 #define __NR_fork                 2
  13 #define __NR_read                 3
  14 #define __NR_write                4
  15 #define __NR_close                6
  16 #define __NR_wait4                7
  17 #define __NR_link                 9
  18 #define __NR_unlink              10
  19 #define __NR_chdir               12
  20 #define __NR_fchdir              13
  21 #define __NR_mknod               14
  22 #define __NR_chmod               15
  23 #define __NR_chown               16
  24 #define __NR_brk                 17
  25 #define __NR_lseek               19
  26 #define __NR_getxpid             20
  27 #define __NR_setuid              23
  28 #define __NR_getxuid             24
  29 #define __NR_ptrace              26
  30 #define __NR_access              33
  31 #define __NR_sync                36
  32 #define __NR_kill                37
  33 #define __NR_setpgid             39
  34 #define __NR_dup                 41
  35 #define __NR_pipe                42
  36 #define __NR_open                45
  37 #define __NR_getxgid             47
  38 #define __NR_ioctl               54
  39 #define __NR_symlink             57
  40 #define __NR_readlink            58
  41 #define __NR_execve              59
  42 #define __NR_umask               60
  43 #define __NR_getpgrp             63
  44 #define __NR_getpagesize         64
  45 #define __NR_stat                67
  46 #define __NR_lstat               68
  47 #define __NR_munmap              73
  48 #define __NR_mprotect            74
  49 #define __NR_madvise             75
  50 #define __NR_vhangup             76
  51 #define __NR_getgroups           79
  52 #define __NR_setgroups           80
  53 #define __NR_setpgrp             82
  54 #define __NR_setitimer           83
  55 #define __NR_getitimer           86
  56 #define __NR_gethostname         87
  57 #define __NR_sethostname         88
  58 #define __NR_getdtablesize       89
  59 #define __NR_dup2                90
  60 #define __NR_fstat               91
  61 #define __NR_fcntl               92
  62 #define __NR_select              93
  63 #define __NR_fsync               95
  64 #define __NR_setpriority         96
  65 #define __NR_socket              97
  66 #define __NR_connect             98
  67 #define __NR_accept              99
  68 #define __NR_getpriority        100
  69 #define __NR_send               101
  70 #define __NR_recv               102
  71 #define __NR_sigreturn          103
  72 #define __NR_bind               104
  73 #define __NR_setsockopt         105
  74 #define __NR_listen             106
  75 #define __NR_sigsuspend         111
  76 #define __NR_gettimeofday       116
  77 #define __NR_getrusage          117
  78 #define __NR_getsockopt         118
  79 #define __NR_settimeofday       122
  80 #define __NR_fchown             123
  81 #define __NR_fchmod             124
  82 #define __NR_recvfrom           125
  83 #define __NR_setreuid           126
  84 #define __NR_setregid           127
  85 #define __NR_rename             128
  86 #define __NR_truncate           129
  87 #define __NR_ftruncate          130
  88 #define __NR_setgid             132
  89 #define __NR_sendto             133
  90 #define __NR_shutdown           134
  91 #define __NR_socketpair         135
  92 #define __NR_mkdir              136
  93 #define __NR_rmdir              137
  94 #define __NR_utimes             138
  95 #define __NR_getpeername        141
  96 #define __NR_getrlimit          144
  97 #define __NR_setrlimit          145
  98 #define __NR_setsid             147
  99 #define __NR_getsockname        150
 100 #define __NR_sigaction          156
 101 #define __NR_msgctl             200
 102 #define __NR_msgget             201
 103 #define __NR_msgrcv             202
 104 #define __NR_msgsnd             203
 105 #define __NR_semctl             204
 106 #define __NR_semget             205
 107 #define __NR_semop              206
 108 #define __NR_shmctl             210
 109 #define __NR_shmdt              211
 110 #define __NR_shmget             212
 111 
 112 /*
 113  * Linux-specific system calls begin at 300
 114  */
 115 #define __NR_bdflush            300
 116 #define __NR_sethae             301
 117 #define __NR_mount              302
 118 #define __NR_adjtimex           303
 119 #define __NR_swapoff            304
 120 #define __NR_getdents           305
 121 #define __NR_create_module      306
 122 #define __NR_init_module        307
 123 #define __NR_delete_module      308
 124 #define __NR_get_kernel_syms    309
 125 #define __NR_syslog             310
 126 
 127 
 128 #ifdef __LIBRARY__
 129 
 130 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
 131 #define _syscall0(type,name) \
 132 type name(void) \
 133 { \
 134         return (type) -1; \
 135 }
 136 
 137 #define _syscall1(type,name,type1,arg1) \
 138 type name(type1 arg1) \
 139 { \
 140         return (type) -1; \
 141 }
 142 
 143 #define _syscall2(type,name,type1,arg1,type2,arg2) \
 144 type name(type1 arg1,type2 arg2) \
 145 { \
 146         return (type) -1; \
 147 }
 148 
 149 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
 150 type name(type1 arg1,type2 arg2,type3 arg3) \
 151 { \
 152         return (type) -1; \
 153 }
 154 
 155 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
 156 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
 157 { \
 158         return (type) -1; \
 159 } 
 160 
 161 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
 162           type5,arg5) \
 163 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
 164 { \
 165         return (type) -1; \
 166 }
 167 
 168 #endif /* __LIBRARY__ */
 169 
 170 #ifdef __KERNEL_SYSCALLS__
 171 
 172 #include <linux/string.h>
 173 
 174 extern unsigned long kernel_fork(void);
 175 static inline unsigned long fork(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 176 {
 177         return kernel_fork();
 178 }
 179 
 180 extern void sys_idle(void);
 181 static inline void idle(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 182 {
 183         sys_idle();
 184 }
 185 
 186 extern int sys_setup(void);
 187 static inline int setup(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 188 {
 189         return sys_setup();
 190 }
 191 
 192 extern int sys_open(const char *, int, int);
 193 static inline int open(const char * name, int mode, int flags)
     /* [previous][next][first][last][top][bottom][index][help] */
 194 {
 195         return sys_open(name, mode, flags);
 196 }
 197 
 198 extern int sys_dup(int);
 199 static inline int dup(int fd)
     /* [previous][next][first][last][top][bottom][index][help] */
 200 {
 201         return sys_dup(fd);
 202 }
 203 
 204 static inline int close(int fd)
     /* [previous][next][first][last][top][bottom][index][help] */
 205 {
 206         return sys_close(fd);
 207 }
 208 
 209 extern int sys_exit(int);
 210 static inline int _exit(int value)
     /* [previous][next][first][last][top][bottom][index][help] */
 211 {
 212         return sys_exit(value);
 213 }
 214 
 215 #define exit(x) _exit(x)
 216 
 217 extern int sys_write(int, const char *, int);
 218 static inline int write(int fd, const char * buf, int nr)
     /* [previous][next][first][last][top][bottom][index][help] */
 219 {
 220         return sys_write(fd, buf, nr);
 221 }
 222 
 223 extern int sys_read(int, char *, int);
 224 static inline int read(int fd, char * buf, int nr)
     /* [previous][next][first][last][top][bottom][index][help] */
 225 {
 226         return sys_read(fd, buf, nr);
 227 }
 228 
 229 extern int do_execve(char *, char **, char **, struct pt_regs *);
 230 extern void ret_from_sys_call(void);
 231 static inline int execve(char * file, char ** argvp, char ** envp)
     /* [previous][next][first][last][top][bottom][index][help] */
 232 {
 233         int i;
 234         struct pt_regs regs;
 235 
 236         memset(&regs, 0, sizeof(regs));
 237         i = do_execve(file, argvp, envp, &regs);
 238         if (!i) {
 239                 __asm__ __volatile__("bis %0,%0,$30\n\t"
 240                                 "bis %1,%1,$26\n\t"
 241                                 "ret $31,($26),1\n\t"
 242                                 : :"r" (&regs), "r" (ret_from_sys_call));
 243         }
 244         return -1;
 245 }
 246 
 247 extern int sys_setsid(void);
 248 static inline int setsid(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 249 {
 250         return sys_setsid();
 251 }
 252 
 253 extern int sys_sync(void);
 254 static inline int sync(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 255 {
 256         return sys_sync();
 257 }
 258 
 259 extern int sys_waitpid(int, int *, int);
 260 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
     /* [previous][next][first][last][top][bottom][index][help] */
 261 {
 262         return sys_waitpid(pid,wait_stat,flags);
 263 }
 264 
 265 static inline pid_t wait(int * wait_stat)
     /* [previous][next][first][last][top][bottom][index][help] */
 266 {
 267         return waitpid(-1,wait_stat,0);
 268 }
 269 
 270 #endif
 271 
 272 #endif /* _ALPHA_UNISTD_H */

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