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