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