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_quotactl 148
104 #define __NR_getsockname 150
105 #define __NR_sigaction 156
106 #define __NR_msgctl 200
107 #define __NR_msgget 201
108 #define __NR_msgrcv 202
109 #define __NR_msgsnd 203
110 #define __NR_semctl 204
111 #define __NR_semget 205
112 #define __NR_semop 206
113 #define __NR_shmctl 210
114 #define __NR_shmdt 211
115 #define __NR_shmget 212
116
117 #define __NR_getsid 234
118
119 #define __NR_getsysinfo 256
120 #define __NR_setsysinfo 257
121
122
123
124
125 #define __NR_bdflush 300
126 #define __NR_sethae 301
127 #define __NR_mount 302
128 #define __NR_adjtimex 303
129 #define __NR_swapoff 304
130 #define __NR_getdents 305
131 #define __NR_create_module 306
132 #define __NR_init_module 307
133 #define __NR_delete_module 308
134 #define __NR_get_kernel_syms 309
135 #define __NR_syslog 310
136 #define __NR_reboot 311
137 #define __NR_clone 312
138 #define __NR_uselib 313
139 #define __NR_mlock 314
140 #define __NR_munlock 315
141 #define __NR_mlockall 316
142 #define __NR_munlockall 317
143
144 #ifdef __LIBRARY__
145
146
147 #define _syscall0(type,name) \
148 type name(void) \
149 { \
150 return (type) -1; \
151 }
152
153 #define _syscall1(type,name,type1,arg1) \
154 type name(type1 arg1) \
155 { \
156 return (type) -1; \
157 }
158
159 #define _syscall2(type,name,type1,arg1,type2,arg2) \
160 type name(type1 arg1,type2 arg2) \
161 { \
162 return (type) -1; \
163 }
164
165 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
166 type name(type1 arg1,type2 arg2,type3 arg3) \
167 { \
168 return (type) -1; \
169 }
170
171 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
172 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
173 { \
174 return (type) -1; \
175 }
176
177 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
178 type5,arg5) \
179 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
180 { \
181 return (type) -1; \
182 }
183
184 #endif
185
186 #ifdef __KERNEL_SYSCALLS__
187
188 #include <linux/string.h>
189 #include <linux/signal.h>
190
191 extern long __kernel_thread(unsigned long, int (*)(void *), void *);
192
193 static inline long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
194 {
195 return __kernel_thread(flags | CLONE_VM, fn, arg);
196 }
197
198 extern void sys_idle(void);
199 static inline void idle(void)
200 {
201 sys_idle();
202 }
203
204 extern int sys_setup(void);
205 static inline int setup(void)
206 {
207 return sys_setup();
208 }
209
210 extern int sys_open(const char *, int, int);
211 static inline int open(const char * name, int mode, int flags)
212 {
213 return sys_open(name, mode, flags);
214 }
215
216 extern int sys_dup(int);
217 static inline int dup(int fd)
218 {
219 return sys_dup(fd);
220 }
221
222 static inline int close(int fd)
223 {
224 return sys_close(fd);
225 }
226
227 extern int sys_exit(int);
228 static inline int _exit(int value)
229 {
230 return sys_exit(value);
231 }
232
233 #define exit(x) _exit(x)
234
235 extern int sys_write(int, const char *, int);
236 static inline int write(int fd, const char * buf, int nr)
237 {
238 return sys_write(fd, buf, nr);
239 }
240
241 extern int sys_read(int, char *, int);
242 static inline int read(int fd, char * buf, int nr)
243 {
244 return sys_read(fd, buf, nr);
245 }
246
247 extern int do_execve(char *, char **, char **, struct pt_regs *);
248 extern void ret_from_sys_call(void);
249 static inline int execve(char * file, char ** argvp, char ** envp)
250 {
251 int i;
252 struct pt_regs regs;
253
254 memset(®s, 0, sizeof(regs));
255 i = do_execve(file, argvp, envp, ®s);
256 if (!i) {
257 __asm__ __volatile__("bis %0,%0,$30\n\t"
258 "bis %1,%1,$26\n\t"
259 "ret $31,($26),1\n\t"
260 : :"r" (®s), "r" (ret_from_sys_call));
261 }
262 return -1;
263 }
264
265 extern int sys_setsid(void);
266 static inline int setsid(void)
267 {
268 return sys_setsid();
269 }
270
271 extern int sys_sync(void);
272 static inline int sync(void)
273 {
274 return sys_sync();
275 }
276
277 extern int sys_waitpid(int, int *, int);
278 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
279 {
280 return sys_waitpid(pid,wait_stat,flags);
281 }
282
283 static inline pid_t wait(int * wait_stat)
284 {
285 return waitpid(-1,wait_stat,0);
286 }
287
288 #endif
289
290 #endif