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 #define __NR_exit 1
5 #define __NR_fork 2
6 #define __NR_read 3
7 #define __NR_write 4
8 #define __NR_close 6
9 #define __NR_wait4 7
10 #define __NR_link 9
11 #define __NR_unlink 10
12 #define __NR_chdir 12
13 #define __NR_fchdir 13
14 #define __NR_mknod 14
15 #define __NR_chmod 15
16 #define __NR_chown 16
17 #define __NR_brk 17
18 #define __NR_lseek 19
19 #define __NR_getxpid 20
20 #define __NR_setuid 23
21 #define __NR_getxuid 24
22 #define __NR_ptrace 26
23 #define __NR_access 33
24 #define __NR_sync 36
25 #define __NR_kill 37
26 #define __NR_setpgid 39
27 #define __NR_dup 41
28 #define __NR_pipe 42
29 #define __NR_open 45
30 #define __NR_getxgid 47
31 #define __NR_acct 51
32 #define __NR_sigpending 52
33 #define __NR_ioctl 54
34 #define __NR_symlink 57
35 #define __NR_readlink 58
36 #define __NR_execve 59
37 #define __NR_umask 60
38 #define __NR_chroot 61
39 #define __NR_getpgrp 63
40 #define __NR_getpagesize 64
41 #define __NR_stat 67
42 #define __NR_lstat 68
43 #define __NR_mmap 71
44 #define __NR_munmap 73
45 #define __NR_mprotect 74
46 #define __NR_madvise 75
47 #define __NR_vhangup 76
48 #define __NR_getgroups 79
49 #define __NR_setgroups 80
50 #define __NR_setpgrp 82
51 #define __NR_setitimer 83
52 #define __NR_getitimer 86
53 #define __NR_gethostname 87
54 #define __NR_sethostname 88
55 #define __NR_getdtablesize 89
56 #define __NR_dup2 90
57 #define __NR_fstat 91
58 #define __NR_fcntl 92
59 #define __NR_select 93
60 #define __NR_fsync 95
61 #define __NR_setpriority 96
62 #define __NR_socket 97
63 #define __NR_connect 98
64 #define __NR_accept 99
65 #define __NR_getpriority 100
66 #define __NR_send 101
67 #define __NR_recv 102
68 #define __NR_sigreturn 103
69 #define __NR_bind 104
70 #define __NR_setsockopt 105
71 #define __NR_listen 106
72 #define __NR_sigsuspend 111
73 #define __NR_gettimeofday 116
74 #define __NR_getrusage 117
75 #define __NR_getsockopt 118
76 #define __NR_readv 120
77 #define __NR_writev 121
78 #define __NR_settimeofday 122
79 #define __NR_fchown 123
80 #define __NR_fchmod 124
81 #define __NR_recvfrom 125
82 #define __NR_setreuid 126
83 #define __NR_setregid 127
84 #define __NR_rename 128
85 #define __NR_truncate 129
86 #define __NR_ftruncate 130
87 #define __NR_flock 131
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_quotactl 148
100 #define __NR_getsockname 150
101 #define __NR_sigaction 156
102 #define __NR_setdomainname 166
103 #define __NR_msgctl 200
104 #define __NR_msgget 201
105 #define __NR_msgrcv 202
106 #define __NR_msgsnd 203
107 #define __NR_semctl 204
108 #define __NR_semget 205
109 #define __NR_semop 206
110 #define __NR_shmctl 210
111 #define __NR_shmdt 211
112 #define __NR_shmget 212
113
114 #define __NR_msync 217
115
116 #define __NR_getpgid 233
117 #define __NR_getsid 234
118
119 #define __NR_sysfs 254
120
121
122
123
124 #define __NR_bdflush 300
125 #define __NR_sethae 301
126 #define __NR_mount 302
127 #define __NR_adjtimex 303
128 #define __NR_swapoff 304
129 #define __NR_getdents 305
130 #define __NR_create_module 306
131 #define __NR_init_module 307
132 #define __NR_delete_module 308
133 #define __NR_get_kernel_syms 309
134 #define __NR_syslog 310
135 #define __NR_reboot 311
136 #define __NR_clone 312
137 #define __NR_uselib 313
138 #define __NR_mlock 314
139 #define __NR_munlock 315
140 #define __NR_mlockall 316
141 #define __NR_munlockall 317
142 #define __NR_sysinfo 318
143 #define __NR_sysctl 319
144 #define __NR_idle 320
145 #define __NR_umount 321
146 #define __NR_swapon 322
147 #define __NR_times 323
148 #define __NR_personality 324
149 #define __NR_setfsuid 325
150 #define __NR_setfsgid 326
151 #define __NR_ustat 327
152 #define __NR_statfs 328
153 #define __NR_fstatfs 329
154 #define __NR_sched_setparam 330
155 #define __NR_sched_getparam 331
156 #define __NR_sched_setscheduler 332
157 #define __NR_sched_getscheduler 333
158 #define __NR_sched_yield 334
159 #define __NR_sched_get_priority_max 335
160 #define __NR_sched_get_priority_min 336
161 #define __NR_sched_rr_get_interval 337
162 #define __NR_afs_syscall 338
163 #define __NR_uname 339
164
165 #ifdef __LIBRARY__
166
167
168
169
170
171
172
173 #define _syscall0(type,name) \
174 type name(void) \
175 { \
176 return (type) -1; \
177 }
178
179 #define _syscall1(type,name,type1,arg1) \
180 type name(type1 arg1) \
181 { \
182 return (type) -1; \
183 }
184
185 #define _syscall2(type,name,type1,arg1,type2,arg2) \
186 type name(type1 arg1,type2 arg2) \
187 { \
188 return (type) -1; \
189 }
190
191 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
192 type name(type1 arg1,type2 arg2,type3 arg3) \
193 { \
194 return (type) -1; \
195 }
196
197 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
198 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
199 { \
200 return (type) -1; \
201 }
202
203 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
204 type5,arg5) \
205 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
206 { \
207 return (type) -1; \
208 }
209
210 #endif
211
212 #ifdef __KERNEL_SYSCALLS__
213
214 #include <linux/string.h>
215 #include <linux/signal.h>
216
217 extern long __kernel_thread(unsigned long, int (*)(void *), void *);
218
219 static inline long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
220 {
221 return __kernel_thread(flags | CLONE_VM, fn, arg);
222 }
223
224 extern void sys_idle(void);
225 static inline void idle(void)
226 {
227 sys_idle();
228 }
229
230 extern int sys_setup(void);
231 static inline int setup(void)
232 {
233 return sys_setup();
234 }
235
236 extern int sys_open(const char *, int, int);
237 static inline int open(const char * name, int mode, int flags)
238 {
239 return sys_open(name, mode, flags);
240 }
241
242 extern int sys_dup(int);
243 static inline int dup(int fd)
244 {
245 return sys_dup(fd);
246 }
247
248 static inline int close(int fd)
249 {
250 return sys_close(fd);
251 }
252
253 extern int sys_exit(int);
254 static inline int _exit(int value)
255 {
256 return sys_exit(value);
257 }
258
259 #define exit(x) _exit(x)
260
261 extern int sys_write(int, const char *, int);
262 static inline int write(int fd, const char * buf, int nr)
263 {
264 return sys_write(fd, buf, nr);
265 }
266
267 extern int sys_read(int, char *, int);
268 static inline int read(int fd, char * buf, int nr)
269 {
270 return sys_read(fd, buf, nr);
271 }
272
273 extern int do_execve(char *, char **, char **, struct pt_regs *);
274 extern void ret_from_sys_call(void);
275 static inline int execve(char * file, char ** argvp, char ** envp)
276 {
277 int i;
278 struct pt_regs regs;
279
280 memset(®s, 0, sizeof(regs));
281 i = do_execve(file, argvp, envp, ®s);
282 if (!i) {
283 __asm__ __volatile__("bis %0,%0,$30\n\t"
284 "bis %1,%1,$26\n\t"
285 "ret $31,($26),1\n\t"
286 : :"r" (®s), "r" (ret_from_sys_call));
287 }
288 return -1;
289 }
290
291 extern int sys_setsid(void);
292 static inline int setsid(void)
293 {
294 return sys_setsid();
295 }
296
297 extern int sys_sync(void);
298 static inline int sync(void)
299 {
300 return sys_sync();
301 }
302
303 extern int sys_wait4(int, int *, int, struct rusage *);
304 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
305 {
306 return sys_wait4(pid, wait_stat, flags, NULL);
307 }
308
309 static inline pid_t wait(int * wait_stat)
310 {
311 return waitpid(-1,wait_stat,0);
312 }
313
314 #endif
315
316 #endif