Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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_restart_syscall 7 |
| 23 | #define __NR_creat 8 |
| 24 | #define __NR_link 9 |
| 25 | #define __NR_unlink 10 |
| 26 | #define __NR_execve 11 |
| 27 | #define __NR_chdir 12 |
| 28 | #define __NR_time 13 |
| 29 | #define __NR_mknod 14 |
| 30 | #define __NR_chmod 15 |
| 31 | #define __NR_lchown 16 |
| 32 | #define __NR_lseek 19 |
| 33 | #define __NR_getpid 20 |
| 34 | #define __NR_mount 21 |
| 35 | #define __NR_umount 22 |
| 36 | #define __NR_setuid 23 |
| 37 | #define __NR_getuid 24 |
| 38 | #define __NR_stime 25 |
| 39 | #define __NR_ptrace 26 |
| 40 | #define __NR_alarm 27 |
| 41 | #define __NR_pause 29 |
| 42 | #define __NR_utime 30 |
| 43 | #define __NR_access 33 |
| 44 | #define __NR_nice 34 |
| 45 | #define __NR_sync 36 |
| 46 | #define __NR_kill 37 |
| 47 | #define __NR_rename 38 |
| 48 | #define __NR_mkdir 39 |
| 49 | #define __NR_rmdir 40 |
| 50 | #define __NR_dup 41 |
| 51 | #define __NR_pipe 42 |
| 52 | #define __NR_times 43 |
| 53 | #define __NR_brk 45 |
| 54 | #define __NR_setgid 46 |
| 55 | #define __NR_getgid 47 |
| 56 | #define __NR_signal 48 |
| 57 | #define __NR_geteuid 49 |
| 58 | #define __NR_getegid 50 |
| 59 | #define __NR_acct 51 |
| 60 | #define __NR_umount2 52 |
| 61 | #define __NR_ioctl 54 |
| 62 | #define __NR_fcntl 55 |
| 63 | #define __NR_setpgid 57 |
| 64 | #define __NR_umask 60 |
| 65 | #define __NR_chroot 61 |
| 66 | #define __NR_ustat 62 |
| 67 | #define __NR_dup2 63 |
| 68 | #define __NR_getppid 64 |
| 69 | #define __NR_getpgrp 65 |
| 70 | #define __NR_setsid 66 |
| 71 | #define __NR_sigaction 67 |
| 72 | #define __NR_setreuid 70 |
| 73 | #define __NR_setregid 71 |
| 74 | #define __NR_sigsuspend 72 |
| 75 | #define __NR_sigpending 73 |
| 76 | #define __NR_sethostname 74 |
| 77 | #define __NR_setrlimit 75 |
| 78 | #define __NR_getrlimit 76 |
| 79 | #define __NR_getrusage 77 |
| 80 | #define __NR_gettimeofday 78 |
| 81 | #define __NR_settimeofday 79 |
| 82 | #define __NR_getgroups 80 |
| 83 | #define __NR_setgroups 81 |
| 84 | #define __NR_symlink 83 |
| 85 | #define __NR_readlink 85 |
| 86 | #define __NR_uselib 86 |
| 87 | #define __NR_swapon 87 |
| 88 | #define __NR_reboot 88 |
| 89 | #define __NR_readdir 89 |
| 90 | #define __NR_mmap 90 |
| 91 | #define __NR_munmap 91 |
| 92 | #define __NR_truncate 92 |
| 93 | #define __NR_ftruncate 93 |
| 94 | #define __NR_fchmod 94 |
| 95 | #define __NR_fchown 95 |
| 96 | #define __NR_getpriority 96 |
| 97 | #define __NR_setpriority 97 |
| 98 | #define __NR_statfs 99 |
| 99 | #define __NR_fstatfs 100 |
| 100 | #define __NR_ioperm 101 |
| 101 | #define __NR_socketcall 102 |
| 102 | #define __NR_syslog 103 |
| 103 | #define __NR_setitimer 104 |
| 104 | #define __NR_getitimer 105 |
| 105 | #define __NR_stat 106 |
| 106 | #define __NR_lstat 107 |
| 107 | #define __NR_fstat 108 |
| 108 | #define __NR_lookup_dcookie 110 |
| 109 | #define __NR_vhangup 111 |
| 110 | #define __NR_idle 112 |
| 111 | #define __NR_wait4 114 |
| 112 | #define __NR_swapoff 115 |
| 113 | #define __NR_sysinfo 116 |
| 114 | #define __NR_ipc 117 |
| 115 | #define __NR_fsync 118 |
| 116 | #define __NR_sigreturn 119 |
| 117 | #define __NR_clone 120 |
| 118 | #define __NR_setdomainname 121 |
| 119 | #define __NR_uname 122 |
| 120 | #define __NR_adjtimex 124 |
| 121 | #define __NR_mprotect 125 |
| 122 | #define __NR_sigprocmask 126 |
| 123 | #define __NR_create_module 127 |
| 124 | #define __NR_init_module 128 |
| 125 | #define __NR_delete_module 129 |
| 126 | #define __NR_get_kernel_syms 130 |
| 127 | #define __NR_quotactl 131 |
| 128 | #define __NR_getpgid 132 |
| 129 | #define __NR_fchdir 133 |
| 130 | #define __NR_bdflush 134 |
| 131 | #define __NR_sysfs 135 |
| 132 | #define __NR_personality 136 |
| 133 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ |
| 134 | #define __NR_setfsuid 138 |
| 135 | #define __NR_setfsgid 139 |
| 136 | #define __NR__llseek 140 |
| 137 | #define __NR_getdents 141 |
| 138 | #define __NR__newselect 142 |
| 139 | #define __NR_flock 143 |
| 140 | #define __NR_msync 144 |
| 141 | #define __NR_readv 145 |
| 142 | #define __NR_writev 146 |
| 143 | #define __NR_getsid 147 |
| 144 | #define __NR_fdatasync 148 |
| 145 | #define __NR__sysctl 149 |
| 146 | #define __NR_mlock 150 |
| 147 | #define __NR_munlock 151 |
| 148 | #define __NR_mlockall 152 |
| 149 | #define __NR_munlockall 153 |
| 150 | #define __NR_sched_setparam 154 |
| 151 | #define __NR_sched_getparam 155 |
| 152 | #define __NR_sched_setscheduler 156 |
| 153 | #define __NR_sched_getscheduler 157 |
| 154 | #define __NR_sched_yield 158 |
| 155 | #define __NR_sched_get_priority_max 159 |
| 156 | #define __NR_sched_get_priority_min 160 |
| 157 | #define __NR_sched_rr_get_interval 161 |
| 158 | #define __NR_nanosleep 162 |
| 159 | #define __NR_mremap 163 |
| 160 | #define __NR_setresuid 164 |
| 161 | #define __NR_getresuid 165 |
| 162 | #define __NR_query_module 167 |
| 163 | #define __NR_poll 168 |
| 164 | #define __NR_nfsservctl 169 |
| 165 | #define __NR_setresgid 170 |
| 166 | #define __NR_getresgid 171 |
| 167 | #define __NR_prctl 172 |
| 168 | #define __NR_rt_sigreturn 173 |
| 169 | #define __NR_rt_sigaction 174 |
| 170 | #define __NR_rt_sigprocmask 175 |
| 171 | #define __NR_rt_sigpending 176 |
| 172 | #define __NR_rt_sigtimedwait 177 |
| 173 | #define __NR_rt_sigqueueinfo 178 |
| 174 | #define __NR_rt_sigsuspend 179 |
| 175 | #define __NR_pread64 180 |
| 176 | #define __NR_pwrite64 181 |
| 177 | #define __NR_chown 182 |
| 178 | #define __NR_getcwd 183 |
| 179 | #define __NR_capget 184 |
| 180 | #define __NR_capset 185 |
| 181 | #define __NR_sigaltstack 186 |
| 182 | #define __NR_sendfile 187 |
| 183 | #define __NR_getpmsg 188 |
| 184 | #define __NR_putpmsg 189 |
| 185 | #define __NR_vfork 190 |
| 186 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ |
| 187 | #define __NR_mmap2 192 |
| 188 | #define __NR_truncate64 193 |
| 189 | #define __NR_ftruncate64 194 |
| 190 | #define __NR_stat64 195 |
| 191 | #define __NR_lstat64 196 |
| 192 | #define __NR_fstat64 197 |
| 193 | #define __NR_lchown32 198 |
| 194 | #define __NR_getuid32 199 |
| 195 | #define __NR_getgid32 200 |
| 196 | #define __NR_geteuid32 201 |
| 197 | #define __NR_getegid32 202 |
| 198 | #define __NR_setreuid32 203 |
| 199 | #define __NR_setregid32 204 |
| 200 | #define __NR_getgroups32 205 |
| 201 | #define __NR_setgroups32 206 |
| 202 | #define __NR_fchown32 207 |
| 203 | #define __NR_setresuid32 208 |
| 204 | #define __NR_getresuid32 209 |
| 205 | #define __NR_setresgid32 210 |
| 206 | #define __NR_getresgid32 211 |
| 207 | #define __NR_chown32 212 |
| 208 | #define __NR_setuid32 213 |
| 209 | #define __NR_setgid32 214 |
| 210 | #define __NR_setfsuid32 215 |
| 211 | #define __NR_setfsgid32 216 |
| 212 | #define __NR_pivot_root 217 |
| 213 | #define __NR_mincore 218 |
| 214 | #define __NR_madvise 219 |
| 215 | #define __NR_getdents64 220 |
| 216 | #define __NR_fcntl64 221 |
| 217 | #define __NR_readahead 222 |
| 218 | #define __NR_sendfile64 223 |
| 219 | #define __NR_setxattr 224 |
| 220 | #define __NR_lsetxattr 225 |
| 221 | #define __NR_fsetxattr 226 |
| 222 | #define __NR_getxattr 227 |
| 223 | #define __NR_lgetxattr 228 |
| 224 | #define __NR_fgetxattr 229 |
| 225 | #define __NR_listxattr 230 |
| 226 | #define __NR_llistxattr 231 |
| 227 | #define __NR_flistxattr 232 |
| 228 | #define __NR_removexattr 233 |
| 229 | #define __NR_lremovexattr 234 |
| 230 | #define __NR_fremovexattr 235 |
| 231 | #define __NR_gettid 236 |
| 232 | #define __NR_tkill 237 |
| 233 | #define __NR_futex 238 |
| 234 | #define __NR_sched_setaffinity 239 |
| 235 | #define __NR_sched_getaffinity 240 |
| 236 | #define __NR_tgkill 241 |
| 237 | /* Number 242 is reserved for tux */ |
| 238 | #define __NR_io_setup 243 |
| 239 | #define __NR_io_destroy 244 |
| 240 | #define __NR_io_getevents 245 |
| 241 | #define __NR_io_submit 246 |
| 242 | #define __NR_io_cancel 247 |
| 243 | #define __NR_exit_group 248 |
| 244 | #define __NR_epoll_create 249 |
| 245 | #define __NR_epoll_ctl 250 |
| 246 | #define __NR_epoll_wait 251 |
| 247 | #define __NR_set_tid_address 252 |
| 248 | #define __NR_fadvise64 253 |
| 249 | #define __NR_timer_create 254 |
| 250 | #define __NR_timer_settime (__NR_timer_create+1) |
| 251 | #define __NR_timer_gettime (__NR_timer_create+2) |
| 252 | #define __NR_timer_getoverrun (__NR_timer_create+3) |
| 253 | #define __NR_timer_delete (__NR_timer_create+4) |
| 254 | #define __NR_clock_settime (__NR_timer_create+5) |
| 255 | #define __NR_clock_gettime (__NR_timer_create+6) |
| 256 | #define __NR_clock_getres (__NR_timer_create+7) |
| 257 | #define __NR_clock_nanosleep (__NR_timer_create+8) |
| 258 | /* Number 263 is reserved for vserver */ |
| 259 | #define __NR_fadvise64_64 264 |
| 260 | #define __NR_statfs64 265 |
| 261 | #define __NR_fstatfs64 266 |
| 262 | #define __NR_remap_file_pages 267 |
| 263 | /* Number 268 is reserved for new sys_mbind */ |
| 264 | /* Number 269 is reserved for new sys_get_mempolicy */ |
| 265 | /* Number 270 is reserved for new sys_set_mempolicy */ |
| 266 | #define __NR_mq_open 271 |
| 267 | #define __NR_mq_unlink 272 |
| 268 | #define __NR_mq_timedsend 273 |
| 269 | #define __NR_mq_timedreceive 274 |
| 270 | #define __NR_mq_notify 275 |
| 271 | #define __NR_mq_getsetattr 276 |
Heiko Carstens | cf13f0e | 2005-06-25 14:58:11 -0700 | [diff] [blame] | 272 | #define __NR_kexec_load 277 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | #define __NR_add_key 278 |
| 274 | #define __NR_request_key 279 |
| 275 | #define __NR_keyctl 280 |
| 276 | #define __NR_waitid 281 |
Martin Schwidefsky | d201348 | 2005-08-01 21:11:34 -0700 | [diff] [blame] | 277 | #define __NR_ioprio_set 282 |
| 278 | #define __NR_ioprio_get 283 |
| 279 | #define __NR_inotify_init 284 |
| 280 | #define __NR_inotify_add_watch 285 |
| 281 | #define __NR_inotify_rm_watch 286 |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 282 | /* Number 287 is reserved for new sys_migrate_pages */ |
| 283 | #define __NR_openat 288 |
| 284 | #define __NR_mkdirat 289 |
| 285 | #define __NR_mknodat 290 |
| 286 | #define __NR_fchownat 291 |
| 287 | #define __NR_futimesat 292 |
Heiko Carstens | 19bf9cb | 2006-02-12 12:35:03 +0100 | [diff] [blame] | 288 | #define __NR_fstatat64 293 |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 289 | #define __NR_unlinkat 294 |
| 290 | #define __NR_renameat 295 |
| 291 | #define __NR_linkat 296 |
| 292 | #define __NR_symlinkat 297 |
| 293 | #define __NR_readlinkat 298 |
| 294 | #define __NR_fchmodat 299 |
| 295 | #define __NR_faccessat 300 |
| 296 | #define __NR_pselect6 301 |
| 297 | #define __NR_ppoll 302 |
Heiko Carstens | e768427 | 2006-02-11 17:56:02 -0800 | [diff] [blame] | 298 | #define __NR_unshare 303 |
Martin Schwidefsky | 0159677 | 2006-05-15 09:44:05 -0700 | [diff] [blame] | 299 | #define __NR_set_robust_list 304 |
| 300 | #define __NR_get_robust_list 305 |
| 301 | #define __NR_splice 306 |
| 302 | #define __NR_sync_file_range 307 |
| 303 | #define __NR_tee 308 |
| 304 | #define __NR_vmsplice 309 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
Martin Schwidefsky | 0159677 | 2006-05-15 09:44:05 -0700 | [diff] [blame] | 306 | #define NR_syscalls 310 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
| 308 | /* |
| 309 | * There are some system calls that are not present on 64 bit, some |
| 310 | * have a different name although they do the same (e.g. __NR_chown32 |
| 311 | * is __NR_chown on 64 bit). |
| 312 | */ |
| 313 | #ifdef __s390x__ |
| 314 | #undef __NR_time |
| 315 | #undef __NR_lchown |
| 316 | #undef __NR_setuid |
| 317 | #undef __NR_getuid |
| 318 | #undef __NR_stime |
| 319 | #undef __NR_setgid |
| 320 | #undef __NR_getgid |
| 321 | #undef __NR_geteuid |
| 322 | #undef __NR_getegid |
| 323 | #undef __NR_setreuid |
| 324 | #undef __NR_setregid |
| 325 | #undef __NR_getrlimit |
| 326 | #undef __NR_getgroups |
| 327 | #undef __NR_setgroups |
| 328 | #undef __NR_fchown |
| 329 | #undef __NR_ioperm |
| 330 | #undef __NR_setfsuid |
| 331 | #undef __NR_setfsgid |
| 332 | #undef __NR__llseek |
| 333 | #undef __NR__newselect |
| 334 | #undef __NR_setresuid |
| 335 | #undef __NR_getresuid |
| 336 | #undef __NR_setresgid |
| 337 | #undef __NR_getresgid |
| 338 | #undef __NR_chown |
| 339 | #undef __NR_ugetrlimit |
| 340 | #undef __NR_mmap2 |
| 341 | #undef __NR_truncate64 |
| 342 | #undef __NR_ftruncate64 |
| 343 | #undef __NR_stat64 |
| 344 | #undef __NR_lstat64 |
| 345 | #undef __NR_fstat64 |
| 346 | #undef __NR_lchown32 |
| 347 | #undef __NR_getuid32 |
| 348 | #undef __NR_getgid32 |
| 349 | #undef __NR_geteuid32 |
| 350 | #undef __NR_getegid32 |
| 351 | #undef __NR_setreuid32 |
| 352 | #undef __NR_setregid32 |
| 353 | #undef __NR_getgroups32 |
| 354 | #undef __NR_setgroups32 |
| 355 | #undef __NR_fchown32 |
| 356 | #undef __NR_setresuid32 |
| 357 | #undef __NR_getresuid32 |
| 358 | #undef __NR_setresgid32 |
| 359 | #undef __NR_getresgid32 |
| 360 | #undef __NR_chown32 |
| 361 | #undef __NR_setuid32 |
| 362 | #undef __NR_setgid32 |
| 363 | #undef __NR_setfsuid32 |
| 364 | #undef __NR_setfsgid32 |
| 365 | #undef __NR_fcntl64 |
| 366 | #undef __NR_sendfile64 |
| 367 | #undef __NR_fadvise64_64 |
Heiko Carstens | 19bf9cb | 2006-02-12 12:35:03 +0100 | [diff] [blame] | 368 | #undef __NR_fstatat64 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | |
| 370 | #define __NR_select 142 |
| 371 | #define __NR_getrlimit 191 /* SuS compliant getrlimit */ |
| 372 | #define __NR_lchown 198 |
| 373 | #define __NR_getuid 199 |
| 374 | #define __NR_getgid 200 |
| 375 | #define __NR_geteuid 201 |
| 376 | #define __NR_getegid 202 |
| 377 | #define __NR_setreuid 203 |
| 378 | #define __NR_setregid 204 |
| 379 | #define __NR_getgroups 205 |
| 380 | #define __NR_setgroups 206 |
| 381 | #define __NR_fchown 207 |
| 382 | #define __NR_setresuid 208 |
| 383 | #define __NR_getresuid 209 |
| 384 | #define __NR_setresgid 210 |
| 385 | #define __NR_getresgid 211 |
| 386 | #define __NR_chown 212 |
| 387 | #define __NR_setuid 213 |
| 388 | #define __NR_setgid 214 |
| 389 | #define __NR_setfsuid 215 |
| 390 | #define __NR_setfsgid 216 |
Heiko Carstens | 19bf9cb | 2006-02-12 12:35:03 +0100 | [diff] [blame] | 391 | #define __NR_newfstatat 293 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | |
| 393 | #endif |
| 394 | |
David Woodhouse | 5614253 | 2006-04-29 01:51:47 +0100 | [diff] [blame] | 395 | #ifdef __KERNEL__ |
| 396 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | #define __syscall_return(type, res) \ |
| 398 | do { \ |
Heiko Carstens | 4980082 | 2006-06-29 14:57:25 +0200 | [diff] [blame] | 399 | if ((unsigned long)(res) >= (unsigned long)(-4095)) {\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | errno = -(res); \ |
| 401 | res = -1; \ |
| 402 | } \ |
| 403 | return (type) (res); \ |
| 404 | } while (0) |
| 405 | |
| 406 | #define _svc_clobber "1", "cc", "memory" |
| 407 | |
| 408 | #define _syscall0(type,name) \ |
| 409 | type name(void) { \ |
| 410 | register long __svcres asm("2"); \ |
| 411 | long __res; \ |
| 412 | __asm__ __volatile__ ( \ |
| 413 | " .if %1 < 256\n" \ |
| 414 | " svc %b1\n" \ |
| 415 | " .else\n" \ |
| 416 | " la %%r1,%1\n" \ |
| 417 | " svc 0\n" \ |
| 418 | " .endif" \ |
| 419 | : "=d" (__svcres) \ |
| 420 | : "i" (__NR_##name) \ |
| 421 | : _svc_clobber ); \ |
| 422 | __res = __svcres; \ |
| 423 | __syscall_return(type,__res); \ |
| 424 | } |
| 425 | |
| 426 | #define _syscall1(type,name,type1,arg1) \ |
| 427 | type name(type1 arg1) { \ |
| 428 | register type1 __arg1 asm("2") = arg1; \ |
| 429 | register long __svcres asm("2"); \ |
| 430 | long __res; \ |
| 431 | __asm__ __volatile__ ( \ |
| 432 | " .if %1 < 256\n" \ |
| 433 | " svc %b1\n" \ |
| 434 | " .else\n" \ |
| 435 | " la %%r1,%1\n" \ |
| 436 | " svc 0\n" \ |
| 437 | " .endif" \ |
| 438 | : "=d" (__svcres) \ |
| 439 | : "i" (__NR_##name), \ |
| 440 | "0" (__arg1) \ |
| 441 | : _svc_clobber ); \ |
| 442 | __res = __svcres; \ |
| 443 | __syscall_return(type,__res); \ |
| 444 | } |
| 445 | |
| 446 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ |
| 447 | type name(type1 arg1, type2 arg2) { \ |
| 448 | register type1 __arg1 asm("2") = arg1; \ |
| 449 | register type2 __arg2 asm("3") = arg2; \ |
| 450 | register long __svcres asm("2"); \ |
| 451 | long __res; \ |
| 452 | __asm__ __volatile__ ( \ |
| 453 | " .if %1 < 256\n" \ |
| 454 | " svc %b1\n" \ |
| 455 | " .else\n" \ |
| 456 | " la %%r1,%1\n" \ |
| 457 | " svc 0\n" \ |
| 458 | " .endif" \ |
| 459 | : "=d" (__svcres) \ |
| 460 | : "i" (__NR_##name), \ |
| 461 | "0" (__arg1), \ |
| 462 | "d" (__arg2) \ |
| 463 | : _svc_clobber ); \ |
| 464 | __res = __svcres; \ |
| 465 | __syscall_return(type,__res); \ |
| 466 | } |
| 467 | |
| 468 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\ |
| 469 | type name(type1 arg1, type2 arg2, type3 arg3) { \ |
| 470 | register type1 __arg1 asm("2") = arg1; \ |
| 471 | register type2 __arg2 asm("3") = arg2; \ |
| 472 | register type3 __arg3 asm("4") = arg3; \ |
| 473 | register long __svcres asm("2"); \ |
| 474 | long __res; \ |
| 475 | __asm__ __volatile__ ( \ |
| 476 | " .if %1 < 256\n" \ |
| 477 | " svc %b1\n" \ |
| 478 | " .else\n" \ |
| 479 | " la %%r1,%1\n" \ |
| 480 | " svc 0\n" \ |
| 481 | " .endif" \ |
| 482 | : "=d" (__svcres) \ |
| 483 | : "i" (__NR_##name), \ |
| 484 | "0" (__arg1), \ |
| 485 | "d" (__arg2), \ |
| 486 | "d" (__arg3) \ |
| 487 | : _svc_clobber ); \ |
| 488 | __res = __svcres; \ |
| 489 | __syscall_return(type,__res); \ |
| 490 | } |
| 491 | |
| 492 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\ |
| 493 | type4,name4) \ |
| 494 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ |
| 495 | register type1 __arg1 asm("2") = arg1; \ |
| 496 | register type2 __arg2 asm("3") = arg2; \ |
| 497 | register type3 __arg3 asm("4") = arg3; \ |
| 498 | register type4 __arg4 asm("5") = arg4; \ |
| 499 | register long __svcres asm("2"); \ |
| 500 | long __res; \ |
| 501 | __asm__ __volatile__ ( \ |
| 502 | " .if %1 < 256\n" \ |
| 503 | " svc %b1\n" \ |
| 504 | " .else\n" \ |
| 505 | " la %%r1,%1\n" \ |
| 506 | " svc 0\n" \ |
| 507 | " .endif" \ |
| 508 | : "=d" (__svcres) \ |
| 509 | : "i" (__NR_##name), \ |
| 510 | "0" (__arg1), \ |
| 511 | "d" (__arg2), \ |
| 512 | "d" (__arg3), \ |
| 513 | "d" (__arg4) \ |
| 514 | : _svc_clobber ); \ |
| 515 | __res = __svcres; \ |
| 516 | __syscall_return(type,__res); \ |
| 517 | } |
| 518 | |
| 519 | #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\ |
| 520 | type4,name4,type5,name5) \ |
| 521 | type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ |
| 522 | type5 arg5) { \ |
| 523 | register type1 __arg1 asm("2") = arg1; \ |
| 524 | register type2 __arg2 asm("3") = arg2; \ |
| 525 | register type3 __arg3 asm("4") = arg3; \ |
| 526 | register type4 __arg4 asm("5") = arg4; \ |
| 527 | register type5 __arg5 asm("6") = arg5; \ |
| 528 | register long __svcres asm("2"); \ |
| 529 | long __res; \ |
| 530 | __asm__ __volatile__ ( \ |
| 531 | " .if %1 < 256\n" \ |
| 532 | " svc %b1\n" \ |
| 533 | " .else\n" \ |
| 534 | " la %%r1,%1\n" \ |
| 535 | " svc 0\n" \ |
| 536 | " .endif" \ |
| 537 | : "=d" (__svcres) \ |
| 538 | : "i" (__NR_##name), \ |
| 539 | "0" (__arg1), \ |
| 540 | "d" (__arg2), \ |
| 541 | "d" (__arg3), \ |
| 542 | "d" (__arg4), \ |
| 543 | "d" (__arg5) \ |
| 544 | : _svc_clobber ); \ |
| 545 | __res = __svcres; \ |
| 546 | __syscall_return(type,__res); \ |
| 547 | } |
| 548 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | #define __ARCH_WANT_IPC_PARSE_VERSION |
| 550 | #define __ARCH_WANT_OLD_READDIR |
| 551 | #define __ARCH_WANT_SYS_ALARM |
| 552 | #define __ARCH_WANT_SYS_GETHOSTNAME |
| 553 | #define __ARCH_WANT_SYS_PAUSE |
| 554 | #define __ARCH_WANT_SYS_SIGNAL |
| 555 | #define __ARCH_WANT_SYS_UTIME |
| 556 | #define __ARCH_WANT_SYS_SOCKETCALL |
| 557 | #define __ARCH_WANT_SYS_FADVISE64 |
| 558 | #define __ARCH_WANT_SYS_GETPGRP |
| 559 | #define __ARCH_WANT_SYS_LLSEEK |
| 560 | #define __ARCH_WANT_SYS_NICE |
| 561 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
| 562 | #define __ARCH_WANT_SYS_OLDUMOUNT |
| 563 | #define __ARCH_WANT_SYS_SIGPENDING |
| 564 | #define __ARCH_WANT_SYS_SIGPROCMASK |
| 565 | #define __ARCH_WANT_SYS_RT_SIGACTION |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 566 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 567 | # ifndef CONFIG_64BIT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | # define __ARCH_WANT_STAT64 |
| 569 | # define __ARCH_WANT_SYS_TIME |
| 570 | # endif |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 571 | # ifdef CONFIG_COMPAT |
| 572 | # define __ARCH_WANT_COMPAT_SYS_TIME |
| 573 | # define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND |
| 574 | # endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | |
| 576 | #ifdef __KERNEL_SYSCALLS__ |
| 577 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | #include <linux/compiler.h> |
| 579 | #include <linux/types.h> |
| 580 | #include <asm/ptrace.h> |
| 581 | #include <asm/stat.h> |
| 582 | #include <linux/syscalls.h> |
| 583 | |
| 584 | /* |
| 585 | * we need this inline - forking from kernel space will result |
| 586 | * in NO COPY ON WRITE (!!!), until an execve is executed. This |
| 587 | * is no problem, but for the stack. This is handled by not letting |
| 588 | * main() use the stack at all after fork(). Thus, no function |
| 589 | * calls - which means inline code for fork too, as otherwise we |
| 590 | * would use the stack upon exit from 'fork()'. |
| 591 | * |
| 592 | * Actually only pause and fork are needed inline, so that there |
| 593 | * won't be any messing with the stack from main(), but we define |
| 594 | * some others too. |
| 595 | */ |
| 596 | #define __NR__exit __NR_exit |
| 597 | static inline _syscall0(pid_t,setsid) |
| 598 | static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) |
| 599 | static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) |
| 600 | static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) |
| 601 | static inline _syscall1(int,dup,int,fd) |
| 602 | static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) |
| 603 | static inline _syscall3(int,open,const char *,file,int,flag,int,mode) |
| 604 | static inline _syscall1(int,close,int,fd) |
| 605 | static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf) |
| 606 | |
| 607 | static inline pid_t waitpid(int pid, int *wait_stat, int flags) |
| 608 | { |
| 609 | return sys_wait4(pid, wait_stat, flags, NULL); |
| 610 | } |
| 611 | struct mmap_arg_struct; |
| 612 | asmlinkage long sys_mmap2(struct mmap_arg_struct __user *arg); |
| 613 | |
| 614 | asmlinkage long sys_execve(struct pt_regs regs); |
| 615 | asmlinkage long sys_clone(struct pt_regs regs); |
| 616 | asmlinkage long sys_fork(struct pt_regs regs); |
| 617 | asmlinkage long sys_vfork(struct pt_regs regs); |
| 618 | asmlinkage long sys_pipe(unsigned long __user *fildes); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | struct sigaction; |
| 620 | asmlinkage long sys_rt_sigaction(int sig, |
| 621 | const struct sigaction __user *act, |
| 622 | struct sigaction __user *oact, |
| 623 | size_t sigsetsize); |
| 624 | |
David Woodhouse | 5614253 | 2006-04-29 01:51:47 +0100 | [diff] [blame] | 625 | #endif /* __KERNEL_SYSCALLS__ */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | |
| 627 | /* |
| 628 | * "Conditional" syscalls |
| 629 | * |
| 630 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), |
| 631 | * but it doesn't work on all toolchains, so we just do it by hand |
| 632 | */ |
| 633 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") |
| 634 | |
David Woodhouse | 5614253 | 2006-04-29 01:51:47 +0100 | [diff] [blame] | 635 | #endif /* __KERNEL__ */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | #endif /* _ASM_S390_UNISTD_H_ */ |