~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-s390/unistd.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  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_vfork              190
182 #define __NR_ugetrlimit         191     /* SuS compliant getrlimit */
183 #define __NR_mmap2              192
184 #define __NR_truncate64         193
185 #define __NR_ftruncate64        194
186 #define __NR_stat64             195
187 #define __NR_lstat64            196
188 #define __NR_fstat64            197
189 #define __NR_lchown32           198
190 #define __NR_getuid32           199
191 #define __NR_getgid32           200
192 #define __NR_geteuid32          201
193 #define __NR_getegid32          202
194 #define __NR_setreuid32         203
195 #define __NR_setregid32         204
196 #define __NR_getgroups32        205
197 #define __NR_setgroups32        206
198 #define __NR_fchown32           207
199 #define __NR_setresuid32        208
200 #define __NR_getresuid32        209
201 #define __NR_setresgid32        210
202 #define __NR_getresgid32        211
203 #define __NR_chown32            212
204 #define __NR_setuid32           213
205 #define __NR_setgid32           214
206 #define __NR_setfsuid32         215
207 #define __NR_setfsgid32         216
208 #define __NR_pivot_root         217
209 #define __NR_mincore            218
210 #define __NR_madvise            219
211 #define __NR_getdents64         220
212 
213 
214 /* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
215 
216 #define __syscall_return(type, res)                          \
217 do {                                                         \
218         if ((unsigned long)(res) >= (unsigned long)(-125)) { \
219                 errno = -(res);                              \
220                 res = -1;                                    \
221         }                                                    \
222         return (type) (res);                                 \
223 } while (0)
224 
225 #define _svc_clobber "cc", "memory"
226 
227 #define _syscall0(type,name)                                 \
228 type name(void) {                                            \
229         long __res;                                          \
230         __asm__ __volatile__ (                               \
231                 "    svc %b1\n"                              \
232                 "    lr  %0,2"                               \
233                 : "=d" (__res)                               \
234                 : "i" (__NR_##name)                          \
235                 : _svc_clobber );                            \
236         __syscall_return(type,__res);                        \
237 }
238 
239 #define _syscall1(type,name,type1,arg1)                      \
240 type name(type1 arg1) {                                      \
241         register type1 __arg1 asm("2") = arg1;               \
242         long __res;                                          \
243         __asm__ __volatile__ (                               \
244                 "    svc %b1\n"                              \
245                 "    lr  %0,2"                               \
246                 : "=d" (__res)                               \
247                 : "i" (__NR_##name),                         \
248                   "d" (__arg1)                               \
249                 : _svc_clobber );                            \
250         __syscall_return(type,__res);                        \
251 }
252 
253 #define _syscall2(type,name,type1,arg1,type2,arg2)           \
254 type name(type1 arg1, type2 arg2) {                          \
255         register type1 __arg1 asm("2") = arg1;               \
256         register type2 __arg2 asm("3") = arg2;               \
257         long __res;                                          \
258         __asm__ __volatile__ (                               \
259                 "    svc %b1\n"                              \
260                 "    lr  %0,2"                               \
261                 : "=d" (__res)                               \
262                 : "i" (__NR_##name),                         \
263                   "d" (__arg1),                              \
264                   "d" (__arg2)                               \
265                 : _svc_clobber );                            \
266         __syscall_return(type,__res);                        \
267 }
268 
269 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\
270 type name(type1 arg1, type2 arg2, type3 arg3) {              \
271         register type1 __arg1 asm("2") = arg1;               \
272         register type2 __arg2 asm("3") = arg2;               \
273         register type3 __arg3 asm("4") = arg3;               \
274         long __res;                                          \
275         __asm__ __volatile__ (                               \
276                 "    svc %b1\n"                              \
277                 "    lr  %0,2"                               \
278                 : "=d" (__res)                               \
279                 : "i" (__NR_##name),                         \
280                   "d" (__arg1),                              \
281                   "d" (__arg2),                              \
282                   "d" (__arg3)                               \
283                 : _svc_clobber );                            \
284         __syscall_return(type,__res);                        \
285 }
286 
287 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\
288                   type4,name4)                               \
289 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) {  \
290         register type1 __arg1 asm("2") = arg1;               \
291         register type2 __arg2 asm("3") = arg2;               \
292         register type3 __arg3 asm("4") = arg3;               \
293         register type4 __arg4 asm("5") = arg4;               \
294         long __res;                                          \
295         __asm__ __volatile__ (                               \
296                 "    svc %b1\n"                              \
297                 "    lr  %0,2"                               \
298                 : "=d" (__res)                               \
299                 : "i" (__NR_##name),                         \
300                   "d" (__arg1),                              \
301                   "d" (__arg2),                              \
302                   "d" (__arg3),                              \
303                   "d" (__arg4)                               \
304                 : _svc_clobber );                            \
305         __syscall_return(type,__res);                        \
306 }
307 
308 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\
309                   type4,name4,type5,name5)                   \
310 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4,    \
311           type5 arg5) {                                      \
312         register type1 __arg1 asm("2") = arg1;               \
313         register type2 __arg2 asm("3") = arg2;               \
314         register type3 __arg3 asm("4") = arg3;               \
315         register type4 __arg4 asm("5") = arg4;               \
316         register type5 __arg5 asm("6") = arg5;               \
317         long __res;                                          \
318         __asm__ __volatile__ (                               \
319                 "    svc %b1\n"                              \
320                 "    lr  %0,2"                               \
321                 : "=d" (__res)                               \
322                 : "i" (__NR_##name),                         \
323                   "d" (__arg1),                              \
324                   "d" (__arg2),                              \
325                   "d" (__arg3),                              \
326                   "d" (__arg4),                              \
327                   "d" (__arg5)                               \
328                 : _svc_clobber );                            \
329         __syscall_return(type,__res);                        \
330 }
331 
332 #ifdef __KERNEL_SYSCALLS__
333 
334 /*
335  * we need this inline - forking from kernel space will result
336  * in NO COPY ON WRITE (!!!), until an execve is executed. This
337  * is no problem, but for the stack. This is handled by not letting
338  * main() use the stack at all after fork(). Thus, no function
339  * calls - which means inline code for fork too, as otherwise we
340  * would use the stack upon exit from 'fork()'.
341  *
342  * Actually only pause and fork are needed inline, so that there
343  * won't be any messing with the stack from main(), but we define
344  * some others too.
345  */
346 #define __NR__exit __NR_exit
347 static inline _syscall0(int,idle)
348 static inline _syscall0(int,pause)
349 static inline _syscall0(int,sync)
350 static inline _syscall0(pid_t,setsid)
351 static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
352 static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
353 static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
354 static inline _syscall1(int,dup,int,fd)
355 static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
356 static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
357 static inline _syscall1(int,close,int,fd)
358 static inline _syscall1(int,_exit,int,exitcode)
359 static inline _syscall1(int,delete_module,const char *,name)
360 static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf)
361 
362 extern int sys_wait4(int, int *, int, struct rusage *);
363 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
364 {
365         return sys_wait4(pid, wait_stat, flags, NULL);
366 }
367 
368 static inline pid_t wait(int * wait_stat)
369 {
370         return waitpid(-1,wait_stat,0);
371 }
372 
373 #endif
374 
375 #endif /* _ASM_S390_UNISTD_H_ */
376 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.