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_recvmsg 113
74 #define __NR_sendmsg 114
75 #define __NR_gettimeofday 116
76 #define __NR_getrusage 117
77 #define __NR_getsockopt 118
78 #define __NR_readv 120
79 #define __NR_writev 121
80 #define __NR_settimeofday 122
81 #define __NR_fchown 123
82 #define __NR_fchmod 124
83 #define __NR_recvfrom 125
84 #define __NR_setreuid 126
85 #define __NR_setregid 127
86 #define __NR_rename 128
87 #define __NR_truncate 129
88 #define __NR_ftruncate 130
89 #define __NR_flock 131
90 #define __NR_setgid 132
91 #define __NR_sendto 133
92 #define __NR_shutdown 134
93 #define __NR_socketpair 135
94 #define __NR_mkdir 136
95 #define __NR_rmdir 137
96 #define __NR_utimes 138
97 #define __NR_getpeername 141
98 #define __NR_getrlimit 144
99 #define __NR_setrlimit 145
100 #define __NR_setsid 147
101 #define __NR_quotactl 148
102 #define __NR_getsockname 150
103 #define __NR_sigaction 156
104 #define __NR_setdomainname 166
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 #define __NR_msync 217
117
118 #define __NR_getpgid 233
119 #define __NR_getsid 234
120
121 #define __NR_sysfs 254
122
123
124
125
126 #define __NR_bdflush 300
127 #define __NR_sethae 301
128 #define __NR_mount 302
129 #define __NR_adjtimex 303
130 #define __NR_swapoff 304
131 #define __NR_getdents 305
132 #define __NR_create_module 306
133 #define __NR_init_module 307
134 #define __NR_delete_module 308
135 #define __NR_get_kernel_syms 309
136 #define __NR_syslog 310
137 #define __NR_reboot 311
138 #define __NR_clone 312
139 #define __NR_uselib 313
140 #define __NR_mlock 314
141 #define __NR_munlock 315
142 #define __NR_mlockall 316
143 #define __NR_munlockall 317
144 #define __NR_sysinfo 318
145 #define __NR_sysctl 319
146 #define __NR_idle 320
147 #define __NR_umount 321
148 #define __NR_swapon 322
149 #define __NR_times 323
150 #define __NR_personality 324
151 #define __NR_setfsuid 325
152 #define __NR_setfsgid 326
153 #define __NR_ustat 327
154 #define __NR_statfs 328
155 #define __NR_fstatfs 329
156 #define __NR_sched_setparam 330
157 #define __NR_sched_getparam 331
158 #define __NR_sched_setscheduler 332
159 #define __NR_sched_getscheduler 333
160 #define __NR_sched_yield 334
161 #define __NR_sched_get_priority_max 335
162 #define __NR_sched_get_priority_min 336
163 #define __NR_sched_rr_get_interval 337
164 #define __NR_afs_syscall 338
165 #define __NR_uname 339
166 #define __NR_nanosleep 340
167
168 #ifdef __LIBRARY__
169
170
171
172
173
174
175
176 #define _syscall0(type,name) \
177 type name(void) \
178 { \
179 return (type) -1; \
180 }
181
182 #define _syscall1(type,name,type1,arg1) \
183 type name(type1 arg1) \
184 { \
185 return (type) -1; \
186 }
187
188 #define _syscall2(type,name,type1,arg1,type2,arg2) \
189 type name(type1 arg1,type2 arg2) \
190 { \
191 return (type) -1; \
192 }
193
194 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
195 type name(type1 arg1,type2 arg2,type3 arg3) \
196 { \
197 return (type) -1; \
198 }
199
200 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
201 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
202 { \
203 return (type) -1; \
204 }
205
206 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
207 type5,arg5) \
208 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
209 { \
210 return (type) -1; \
211 }
212
213 #endif
214
215 #ifdef __KERNEL_SYSCALLS__
216
217 #include <linux/string.h>
218 #include <linux/signal.h>
219
220 extern long __kernel_thread(unsigned long, int (*)(void *), void *);
221
222 static inline long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
223 {
224 return __kernel_thread(flags | CLONE_VM, fn, arg);
225 }
226
227 extern void sys_idle(void);
228 static inline void idle(void)
229 {
230 sys_idle();
231 }
232
233 extern int sys_setup(void);
234 static inline int setup(void)
235 {
236 return sys_setup();
237 }
238
239 extern int sys_open(const char *, int, int);
240 static inline int open(const char * name, int mode, int flags)
241 {
242 return sys_open(name, mode, flags);
243 }
244
245 extern int sys_dup(int);
246 static inline int dup(int fd)
247 {
248 return sys_dup(fd);
249 }
250
251 static inline int close(int fd)
252 {
253 return sys_close(fd);
254 }
255
256 extern int sys_exit(int);
257 static inline int _exit(int value)
258 {
259 return sys_exit(value);
260 }
261
262 #define exit(x) _exit(x)
263
264 extern int sys_write(int, const char *, int);
265 static inline int write(int fd, const char * buf, int nr)
266 {
267 return sys_write(fd, buf, nr);
268 }
269
270 extern int sys_read(int, char *, int);
271 static inline int read(int fd, char * buf, int nr)
272 {
273 return sys_read(fd, buf, nr);
274 }
275
276 extern int do_execve(char *, char **, char **, struct pt_regs *);
277 extern void ret_from_sys_call(void);
278 static inline int execve(char * file, char ** argvp, char ** envp)
279 {
280 int i;
281 struct pt_regs regs;
282
283 memset(®s, 0, sizeof(regs));
284 i = do_execve(file, argvp, envp, ®s);
285 if (!i) {
286 __asm__ __volatile__("bis %0,%0,$30\n\t"
287 "bis %1,%1,$26\n\t"
288 "ret $31,($26),1\n\t"
289 : :"r" (®s), "r" (ret_from_sys_call));
290 }
291 return -1;
292 }
293
294 extern int sys_setsid(void);
295 static inline int setsid(void)
296 {
297 return sys_setsid();
298 }
299
300 extern int sys_sync(void);
301 static inline int sync(void)
302 {
303 return sys_sync();
304 }
305
306 extern int sys_wait4(int, int *, int, struct rusage *);
307 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
308 {
309 return sys_wait4(pid, wait_stat, flags, NULL);
310 }
311
312 static inline pid_t wait(int * wait_stat)
313 {
314 return waitpid(-1,wait_stat,0);
315 }
316
317 #endif
318
319 #endif