1 |
1275 |
phoenix |
/*
|
2 |
|
|
* include/asm-s390/unistd.h
|
3 |
|
|
*
|
4 |
|
|
* S390 version
|
5 |
|
|
*
|
6 |
|
|
* Derived from "include/asm-i386/unistd.h"
|
7 |
|
|
*/
|
8 |
|
|
|
9 |
|
|
#ifndef _ASM_S390_UNISTD_H_
|
10 |
|
|
#define _ASM_S390_UNISTD_H_
|
11 |
|
|
|
12 |
|
|
/*
|
13 |
|
|
* This file contains the system call numbers.
|
14 |
|
|
*/
|
15 |
|
|
|
16 |
|
|
#define __NR_exit 1
|
17 |
|
|
#define __NR_fork 2
|
18 |
|
|
#define __NR_read 3
|
19 |
|
|
#define __NR_write 4
|
20 |
|
|
#define __NR_open 5
|
21 |
|
|
#define __NR_close 6
|
22 |
|
|
#define __NR_creat 8
|
23 |
|
|
#define __NR_link 9
|
24 |
|
|
#define __NR_unlink 10
|
25 |
|
|
#define __NR_execve 11
|
26 |
|
|
#define __NR_chdir 12
|
27 |
|
|
#define __NR_mknod 14
|
28 |
|
|
#define __NR_chmod 15
|
29 |
|
|
#define __NR_lseek 19
|
30 |
|
|
#define __NR_getpid 20
|
31 |
|
|
#define __NR_mount 21
|
32 |
|
|
#define __NR_umount 22
|
33 |
|
|
#define __NR_ptrace 26
|
34 |
|
|
#define __NR_alarm 27
|
35 |
|
|
#define __NR_pause 29
|
36 |
|
|
#define __NR_utime 30
|
37 |
|
|
#define __NR_access 33
|
38 |
|
|
#define __NR_nice 34
|
39 |
|
|
#define __NR_sync 36
|
40 |
|
|
#define __NR_kill 37
|
41 |
|
|
#define __NR_rename 38
|
42 |
|
|
#define __NR_mkdir 39
|
43 |
|
|
#define __NR_rmdir 40
|
44 |
|
|
#define __NR_dup 41
|
45 |
|
|
#define __NR_pipe 42
|
46 |
|
|
#define __NR_times 43
|
47 |
|
|
#define __NR_brk 45
|
48 |
|
|
#define __NR_signal 48
|
49 |
|
|
#define __NR_acct 51
|
50 |
|
|
#define __NR_umount2 52
|
51 |
|
|
#define __NR_ioctl 54
|
52 |
|
|
#define __NR_fcntl 55
|
53 |
|
|
#define __NR_setpgid 57
|
54 |
|
|
#define __NR_umask 60
|
55 |
|
|
#define __NR_chroot 61
|
56 |
|
|
#define __NR_ustat 62
|
57 |
|
|
#define __NR_dup2 63
|
58 |
|
|
#define __NR_getppid 64
|
59 |
|
|
#define __NR_getpgrp 65
|
60 |
|
|
#define __NR_setsid 66
|
61 |
|
|
#define __NR_sigaction 67
|
62 |
|
|
#define __NR_sigsuspend 72
|
63 |
|
|
#define __NR_sigpending 73
|
64 |
|
|
#define __NR_sethostname 74
|
65 |
|
|
#define __NR_setrlimit 75
|
66 |
|
|
#define __NR_getrusage 77
|
67 |
|
|
#define __NR_gettimeofday 78
|
68 |
|
|
#define __NR_settimeofday 79
|
69 |
|
|
#define __NR_symlink 83
|
70 |
|
|
#define __NR_readlink 85
|
71 |
|
|
#define __NR_uselib 86
|
72 |
|
|
#define __NR_swapon 87
|
73 |
|
|
#define __NR_reboot 88
|
74 |
|
|
#define __NR_readdir 89
|
75 |
|
|
#define __NR_mmap 90
|
76 |
|
|
#define __NR_munmap 91
|
77 |
|
|
#define __NR_truncate 92
|
78 |
|
|
#define __NR_ftruncate 93
|
79 |
|
|
#define __NR_fchmod 94
|
80 |
|
|
#define __NR_getpriority 96
|
81 |
|
|
#define __NR_setpriority 97
|
82 |
|
|
#define __NR_statfs 99
|
83 |
|
|
#define __NR_fstatfs 100
|
84 |
|
|
#define __NR_socketcall 102
|
85 |
|
|
#define __NR_syslog 103
|
86 |
|
|
#define __NR_setitimer 104
|
87 |
|
|
#define __NR_getitimer 105
|
88 |
|
|
#define __NR_stat 106
|
89 |
|
|
#define __NR_lstat 107
|
90 |
|
|
#define __NR_fstat 108
|
91 |
|
|
#define __NR_vhangup 111
|
92 |
|
|
#define __NR_idle 112
|
93 |
|
|
#define __NR_wait4 114
|
94 |
|
|
#define __NR_swapoff 115
|
95 |
|
|
#define __NR_sysinfo 116
|
96 |
|
|
#define __NR_ipc 117
|
97 |
|
|
#define __NR_fsync 118
|
98 |
|
|
#define __NR_sigreturn 119
|
99 |
|
|
#define __NR_clone 120
|
100 |
|
|
#define __NR_setdomainname 121
|
101 |
|
|
#define __NR_uname 122
|
102 |
|
|
#define __NR_adjtimex 124
|
103 |
|
|
#define __NR_mprotect 125
|
104 |
|
|
#define __NR_sigprocmask 126
|
105 |
|
|
#define __NR_create_module 127
|
106 |
|
|
#define __NR_init_module 128
|
107 |
|
|
#define __NR_delete_module 129
|
108 |
|
|
#define __NR_get_kernel_syms 130
|
109 |
|
|
#define __NR_quotactl 131
|
110 |
|
|
#define __NR_getpgid 132
|
111 |
|
|
#define __NR_fchdir 133
|
112 |
|
|
#define __NR_bdflush 134
|
113 |
|
|
#define __NR_sysfs 135
|
114 |
|
|
#define __NR_personality 136
|
115 |
|
|
#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
|
116 |
|
|
#define __NR_getdents 141
|
117 |
|
|
#define __NR_select 142
|
118 |
|
|
#define __NR_flock 143
|
119 |
|
|
#define __NR_msync 144
|
120 |
|
|
#define __NR_readv 145
|
121 |
|
|
#define __NR_writev 146
|
122 |
|
|
#define __NR_getsid 147
|
123 |
|
|
#define __NR_fdatasync 148
|
124 |
|
|
#define __NR__sysctl 149
|
125 |
|
|
#define __NR_mlock 150
|
126 |
|
|
#define __NR_munlock 151
|
127 |
|
|
#define __NR_mlockall 152
|
128 |
|
|
#define __NR_munlockall 153
|
129 |
|
|
#define __NR_sched_setparam 154
|
130 |
|
|
#define __NR_sched_getparam 155
|
131 |
|
|
#define __NR_sched_setscheduler 156
|
132 |
|
|
#define __NR_sched_getscheduler 157
|
133 |
|
|
#define __NR_sched_yield 158
|
134 |
|
|
#define __NR_sched_get_priority_max 159
|
135 |
|
|
#define __NR_sched_get_priority_min 160
|
136 |
|
|
#define __NR_sched_rr_get_interval 161
|
137 |
|
|
#define __NR_nanosleep 162
|
138 |
|
|
#define __NR_mremap 163
|
139 |
|
|
#define __NR_query_module 167
|
140 |
|
|
#define __NR_poll 168
|
141 |
|
|
#define __NR_nfsservctl 169
|
142 |
|
|
#define __NR_prctl 172
|
143 |
|
|
#define __NR_rt_sigreturn 173
|
144 |
|
|
#define __NR_rt_sigaction 174
|
145 |
|
|
#define __NR_rt_sigprocmask 175
|
146 |
|
|
#define __NR_rt_sigpending 176
|
147 |
|
|
#define __NR_rt_sigtimedwait 177
|
148 |
|
|
#define __NR_rt_sigqueueinfo 178
|
149 |
|
|
#define __NR_rt_sigsuspend 179
|
150 |
|
|
#define __NR_pread 180
|
151 |
|
|
#define __NR_pwrite 181
|
152 |
|
|
#define __NR_getcwd 183
|
153 |
|
|
#define __NR_capget 184
|
154 |
|
|
#define __NR_capset 185
|
155 |
|
|
#define __NR_sigaltstack 186
|
156 |
|
|
#define __NR_sendfile 187
|
157 |
|
|
#define __NR_getpmsg 188
|
158 |
|
|
#define __NR_putpmsg 189
|
159 |
|
|
#define __NR_vfork 190
|
160 |
|
|
#define __NR_getrlimit 191 /* SuS compliant getrlimit */
|
161 |
|
|
#define __NR_lchown 198
|
162 |
|
|
#define __NR_getuid 199
|
163 |
|
|
#define __NR_getgid 200
|
164 |
|
|
#define __NR_geteuid 201
|
165 |
|
|
#define __NR_getegid 202
|
166 |
|
|
#define __NR_setreuid 203
|
167 |
|
|
#define __NR_setregid 204
|
168 |
|
|
#define __NR_getgroups 205
|
169 |
|
|
#define __NR_setgroups 206
|
170 |
|
|
#define __NR_fchown 207
|
171 |
|
|
#define __NR_setresuid 208
|
172 |
|
|
#define __NR_getresuid 209
|
173 |
|
|
#define __NR_setresgid 210
|
174 |
|
|
#define __NR_getresgid 211
|
175 |
|
|
#define __NR_chown 212
|
176 |
|
|
#define __NR_setuid 213
|
177 |
|
|
#define __NR_setgid 214
|
178 |
|
|
#define __NR_setfsuid 215
|
179 |
|
|
#define __NR_setfsgid 216
|
180 |
|
|
#define __NR_pivot_root 217
|
181 |
|
|
#define __NR_mincore 218
|
182 |
|
|
#define __NR_madvise 219
|
183 |
|
|
#define __NR_readahead 222
|
184 |
|
|
/*
|
185 |
|
|
* Numbers 224-235 are reserved for posix acl
|
186 |
|
|
*/
|
187 |
|
|
#define __NR_gettid 236
|
188 |
|
|
#define __NR_tkill 237
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
|
192 |
|
|
|
193 |
|
|
#define __syscall_return(type, res) \
|
194 |
|
|
do { \
|
195 |
|
|
if ((unsigned long)(res) >= (unsigned long)(-125)) { \
|
196 |
|
|
errno = -(res); \
|
197 |
|
|
res = -1; \
|
198 |
|
|
} \
|
199 |
|
|
return (type) (res); \
|
200 |
|
|
} while (0)
|
201 |
|
|
|
202 |
|
|
#define _svc_clobber "cc", "memory"
|
203 |
|
|
|
204 |
|
|
#define _syscall0(type,name) \
|
205 |
|
|
type name(void) { \
|
206 |
|
|
register long __svcres asm("2"); \
|
207 |
|
|
long __res; \
|
208 |
|
|
__asm__ __volatile__ ( \
|
209 |
|
|
" svc %b1\n" \
|
210 |
|
|
: "=d" (__svcres) \
|
211 |
|
|
: "i" (__NR_##name) \
|
212 |
|
|
: _svc_clobber ); \
|
213 |
|
|
__res = __svcres; \
|
214 |
|
|
__syscall_return(type,__res); \
|
215 |
|
|
}
|
216 |
|
|
|
217 |
|
|
#define _syscall1(type,name,type1,arg1) \
|
218 |
|
|
type name(type1 arg1) { \
|
219 |
|
|
register type1 __arg1 asm("2") = arg1; \
|
220 |
|
|
register long __svcres asm("2"); \
|
221 |
|
|
long __res; \
|
222 |
|
|
__asm__ __volatile__ ( \
|
223 |
|
|
" svc %b1\n" \
|
224 |
|
|
: "=d" (__svcres) \
|
225 |
|
|
: "i" (__NR_##name), \
|
226 |
|
|
"0" (__arg1) \
|
227 |
|
|
: _svc_clobber ); \
|
228 |
|
|
__res = __svcres; \
|
229 |
|
|
__syscall_return(type,__res); \
|
230 |
|
|
}
|
231 |
|
|
|
232 |
|
|
#define _syscall2(type,name,type1,arg1,type2,arg2) \
|
233 |
|
|
type name(type1 arg1, type2 arg2) { \
|
234 |
|
|
register type1 __arg1 asm("2") = arg1; \
|
235 |
|
|
register type2 __arg2 asm("3") = arg2; \
|
236 |
|
|
register long __svcres asm("2"); \
|
237 |
|
|
long __res; \
|
238 |
|
|
__asm__ __volatile__ ( \
|
239 |
|
|
" svc %b1\n" \
|
240 |
|
|
: "=d" (__svcres) \
|
241 |
|
|
: "i" (__NR_##name), \
|
242 |
|
|
"0" (__arg1), \
|
243 |
|
|
"d" (__arg2) \
|
244 |
|
|
: _svc_clobber ); \
|
245 |
|
|
__res = __svcres; \
|
246 |
|
|
__syscall_return(type,__res); \
|
247 |
|
|
}
|
248 |
|
|
|
249 |
|
|
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\
|
250 |
|
|
type name(type1 arg1, type2 arg2, type3 arg3) { \
|
251 |
|
|
register type1 __arg1 asm("2") = arg1; \
|
252 |
|
|
register type2 __arg2 asm("3") = arg2; \
|
253 |
|
|
register type3 __arg3 asm("4") = arg3; \
|
254 |
|
|
register long __svcres asm("2"); \
|
255 |
|
|
long __res; \
|
256 |
|
|
__asm__ __volatile__ ( \
|
257 |
|
|
" svc %b1\n" \
|
258 |
|
|
: "=d" (__svcres) \
|
259 |
|
|
: "i" (__NR_##name), \
|
260 |
|
|
"0" (__arg1), \
|
261 |
|
|
"d" (__arg2), \
|
262 |
|
|
"d" (__arg3) \
|
263 |
|
|
: _svc_clobber ); \
|
264 |
|
|
__res = __svcres; \
|
265 |
|
|
__syscall_return(type,__res); \
|
266 |
|
|
}
|
267 |
|
|
|
268 |
|
|
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\
|
269 |
|
|
type4,name4) \
|
270 |
|
|
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
|
271 |
|
|
register type1 __arg1 asm("2") = arg1; \
|
272 |
|
|
register type2 __arg2 asm("3") = arg2; \
|
273 |
|
|
register type3 __arg3 asm("4") = arg3; \
|
274 |
|
|
register type4 __arg4 asm("5") = arg4; \
|
275 |
|
|
register long __svcres asm("2"); \
|
276 |
|
|
long __res; \
|
277 |
|
|
__asm__ __volatile__ ( \
|
278 |
|
|
" svc %b1\n" \
|
279 |
|
|
: "=d" (__svcres) \
|
280 |
|
|
: "i" (__NR_##name), \
|
281 |
|
|
"0" (__arg1), \
|
282 |
|
|
"d" (__arg2), \
|
283 |
|
|
"d" (__arg3), \
|
284 |
|
|
"d" (__arg4) \
|
285 |
|
|
: _svc_clobber ); \
|
286 |
|
|
__res = __svcres; \
|
287 |
|
|
__syscall_return(type,__res); \
|
288 |
|
|
}
|
289 |
|
|
|
290 |
|
|
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\
|
291 |
|
|
type4,name4,type5,name5) \
|
292 |
|
|
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
|
293 |
|
|
type5 arg5) { \
|
294 |
|
|
register type1 __arg1 asm("2") = arg1; \
|
295 |
|
|
register type2 __arg2 asm("3") = arg2; \
|
296 |
|
|
register type3 __arg3 asm("4") = arg3; \
|
297 |
|
|
register type4 __arg4 asm("5") = arg4; \
|
298 |
|
|
register type5 __arg5 asm("6") = arg5; \
|
299 |
|
|
register long __svcres asm("2"); \
|
300 |
|
|
long __res; \
|
301 |
|
|
__asm__ __volatile__ ( \
|
302 |
|
|
" svc %b1\n" \
|
303 |
|
|
: "=d" (__svcres) \
|
304 |
|
|
: "i" (__NR_##name), \
|
305 |
|
|
"0" (__arg1), \
|
306 |
|
|
"d" (__arg2), \
|
307 |
|
|
"d" (__arg3), \
|
308 |
|
|
"d" (__arg4), \
|
309 |
|
|
"d" (__arg5) \
|
310 |
|
|
: _svc_clobber ); \
|
311 |
|
|
__res = __svcres; \
|
312 |
|
|
__syscall_return(type,__res); \
|
313 |
|
|
}
|
314 |
|
|
|
315 |
|
|
#ifdef __KERNEL_SYSCALLS__
|
316 |
|
|
|
317 |
|
|
/*
|
318 |
|
|
* we need this inline - forking from kernel space will result
|
319 |
|
|
* in NO COPY ON WRITE (!!!), until an execve is executed. This
|
320 |
|
|
* is no problem, but for the stack. This is handled by not letting
|
321 |
|
|
* main() use the stack at all after fork(). Thus, no function
|
322 |
|
|
* calls - which means inline code for fork too, as otherwise we
|
323 |
|
|
* would use the stack upon exit from 'fork()'.
|
324 |
|
|
*
|
325 |
|
|
* Actually only pause and fork are needed inline, so that there
|
326 |
|
|
* won't be any messing with the stack from main(), but we define
|
327 |
|
|
* some others too.
|
328 |
|
|
*/
|
329 |
|
|
#define __NR__exit __NR_exit
|
330 |
|
|
static inline _syscall0(int,idle)
|
331 |
|
|
static inline _syscall0(int,pause)
|
332 |
|
|
static inline _syscall0(int,sync)
|
333 |
|
|
static inline _syscall0(pid_t,setsid)
|
334 |
|
|
static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
|
335 |
|
|
static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
|
336 |
|
|
static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
|
337 |
|
|
static inline _syscall1(int,dup,int,fd)
|
338 |
|
|
static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
|
339 |
|
|
static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
|
340 |
|
|
static inline _syscall1(int,close,int,fd)
|
341 |
|
|
static inline _syscall1(int,_exit,int,exitcode)
|
342 |
|
|
static inline _syscall1(int,delete_module,const char *,name)
|
343 |
|
|
static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf)
|
344 |
|
|
|
345 |
|
|
static inline pid_t waitpid(int pid, int * wait_stat, int flags)
|
346 |
|
|
{
|
347 |
|
|
return sys_wait4(pid, wait_stat, flags, NULL);
|
348 |
|
|
}
|
349 |
|
|
|
350 |
|
|
static inline pid_t wait(int * wait_stat)
|
351 |
|
|
{
|
352 |
|
|
return waitpid(-1,wait_stat,0);
|
353 |
|
|
}
|
354 |
|
|
|
355 |
|
|
#endif
|
356 |
|
|
|
357 |
|
|
#endif /* _ASM_S390_UNISTD_H_ */
|