This source file includes following definitions.
- kernel_thread
- idle
- setup
- open
- dup
- close
- _exit
- write
- read
- execve
- setsid
- sync
- waitpid
- wait
1 #ifndef _ALPHA_UNISTD_H
2 #define _ALPHA_UNISTD_H
3
4
5
6
7
8
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_acct 51
39 #define __NR_ioctl 54
40 #define __NR_symlink 57
41 #define __NR_readlink 58
42 #define __NR_execve 59
43 #define __NR_umask 60
44 #define __NR_chroot 61
45 #define __NR_getpgrp 63
46 #define __NR_getpagesize 64
47 #define __NR_stat 67
48 #define __NR_lstat 68
49 #define __NR_munmap 73
50 #define __NR_mprotect 74
51 #define __NR_madvise 75
52 #define __NR_vhangup 76
53 #define __NR_getgroups 79
54 #define __NR_setgroups 80
55 #define __NR_setpgrp 82
56 #define __NR_setitimer 83
57 #define __NR_getitimer 86
58 #define __NR_gethostname 87
59 #define __NR_sethostname 88
60 #define __NR_getdtablesize 89
61 #define __NR_dup2 90
62 #define __NR_fstat 91
63 #define __NR_fcntl 92
64 #define __NR_select 93
65 #define __NR_fsync 95
66 #define __NR_setpriority 96
67 #define __NR_socket 97
68 #define __NR_connect 98
69 #define __NR_accept 99
70 #define __NR_getpriority 100
71 #define __NR_send 101
72 #define __NR_recv 102
73 #define __NR_sigreturn 103
74 #define __NR_bind 104
75 #define __NR_setsockopt 105
76 #define __NR_listen 106
77 #define __NR_sigsuspend 111
78 #define __NR_gettimeofday 116
79 #define __NR_getrusage 117
80 #define __NR_getsockopt 118
81 #define __NR_readv 120
82 #define __NR_writev 121
83 #define __NR_settimeofday 122
84 #define __NR_fchown 123
85 #define __NR_fchmod 124
86 #define __NR_recvfrom 125
87 #define __NR_setreuid 126
88 #define __NR_setregid 127
89 #define __NR_rename 128
90 #define __NR_truncate 129
91 #define __NR_ftruncate 130
92 #define __NR_setgid 132
93 #define __NR_sendto 133
94 #define __NR_shutdown 134
95 #define __NR_socketpair 135
96 #define __NR_mkdir 136
97 #define __NR_rmdir 137
98 #define __NR_utimes 138
99 #define __NR_getpeername 141
100 #define __NR_getrlimit 144
101 #define __NR_setrlimit 145
102 #define __NR_setsid 147
103 #define __NR_getsockname 150
104 #define __NR_sigaction 156
105 #define __NR_msgctl 200
106 #define __NR_msgget 201
107 #define __NR_msgrcv 202
108 #define __NR_msgsnd 203
109 #define __NR_semctl 204
110 #define __NR_semget 205
111 #define __NR_semop 206
112 #define __NR_shmctl 210
113 #define __NR_shmdt 211
114 #define __NR_shmget 212
115
116
117
118
119 #define __NR_bdflush 300
120 #define __NR_sethae 301
121 #define __NR_mount 302
122 #define __NR_adjtimex 303
123 #define __NR_swapoff 304
124 #define __NR_getdents 305
125 #define __NR_create_module 306
126 #define __NR_init_module 307
127 #define __NR_delete_module 308
128 #define __NR_get_kernel_syms 309
129 #define __NR_syslog 310
130 #define __NR_reboot 311
131 #define __NR_clone 312
132 #define __NR_uselib 313
133
134 #ifdef __LIBRARY__
135
136
137 #define _syscall0(type,name) \
138 type name(void) \
139 { \
140 return (type) -1; \
141 }
142
143 #define _syscall1(type,name,type1,arg1) \
144 type name(type1 arg1) \
145 { \
146 return (type) -1; \
147 }
148
149 #define _syscall2(type,name,type1,arg1,type2,arg2) \
150 type name(type1 arg1,type2 arg2) \
151 { \
152 return (type) -1; \
153 }
154
155 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
156 type name(type1 arg1,type2 arg2,type3 arg3) \
157 { \
158 return (type) -1; \
159 }
160
161 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
162 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
163 { \
164 return (type) -1; \
165 }
166
167 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
168 type5,arg5) \
169 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
170 { \
171 return (type) -1; \
172 }
173
174 #endif
175
176 #ifdef __KERNEL_SYSCALLS__
177
178 #include <linux/string.h>
179 #include <linux/signal.h>
180
181 extern long __kernel_thread(unsigned long, int (*)(void *), void *);
182
183 static inline long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
184 {
185 return __kernel_thread(flags | CLONE_VM, fn, arg);
186 }
187
188 extern void sys_idle(void);
189 static inline void idle(void)
190 {
191 sys_idle();
192 }
193
194 extern int sys_setup(void);
195 static inline int setup(void)
196 {
197 return sys_setup();
198 }
199
200 extern int sys_open(const char *, int, int);
201 static inline int open(const char * name, int mode, int flags)
202 {
203 return sys_open(name, mode, flags);
204 }
205
206 extern int sys_dup(int);
207 static inline int dup(int fd)
208 {
209 return sys_dup(fd);
210 }
211
212 static inline int close(int fd)
213 {
214 return sys_close(fd);
215 }
216
217 extern int sys_exit(int);
218 static inline int _exit(int value)
219 {
220 return sys_exit(value);
221 }
222
223 #define exit(x) _exit(x)
224
225 extern int sys_write(int, const char *, int);
226 static inline int write(int fd, const char * buf, int nr)
227 {
228 return sys_write(fd, buf, nr);
229 }
230
231 extern int sys_read(int, char *, int);
232 static inline int read(int fd, char * buf, int nr)
233 {
234 return sys_read(fd, buf, nr);
235 }
236
237 extern int do_execve(char *, char **, char **, struct pt_regs *);
238 extern void ret_from_sys_call(void);
239 static inline int execve(char * file, char ** argvp, char ** envp)
240 {
241 int i;
242 struct pt_regs regs;
243
244 memset(®s, 0, sizeof(regs));
245 i = do_execve(file, argvp, envp, ®s);
246 if (!i) {
247 __asm__ __volatile__("bis %0,%0,$30\n\t"
248 "bis %1,%1,$26\n\t"
249 "ret $31,($26),1\n\t"
250 : :"r" (®s), "r" (ret_from_sys_call));
251 }
252 return -1;
253 }
254
255 extern int sys_setsid(void);
256 static inline int setsid(void)
257 {
258 return sys_setsid();
259 }
260
261 extern int sys_sync(void);
262 static inline int sync(void)
263 {
264 return sys_sync();
265 }
266
267 extern int sys_waitpid(int, int *, int);
268 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
269 {
270 return sys_waitpid(pid,wait_stat,flags);
271 }
272
273 static inline pid_t wait(int * wait_stat)
274 {
275 return waitpid(-1,wait_stat,0);
276 }
277
278 #endif
279
280 #endif