OLD | NEW |
1 /* Copyright (c) 2005-2011, Google Inc. | 1 /* Copyright (c) 2005-2011, Google Inc. |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 * A pointer to this symbol can be obtained by calling | 75 * A pointer to this symbol can be obtained by calling |
76 * get_syscall_entrypoint() | 76 * get_syscall_entrypoint() |
77 * | 77 * |
78 * This file defines a few internal symbols that all start with "LSS_". | 78 * This file defines a few internal symbols that all start with "LSS_". |
79 * Do not access these symbols from outside this file. They are not part | 79 * Do not access these symbols from outside this file. They are not part |
80 * of the supported API. | 80 * of the supported API. |
81 */ | 81 */ |
82 #ifndef SYS_LINUX_SYSCALL_SUPPORT_H | 82 #ifndef SYS_LINUX_SYSCALL_SUPPORT_H |
83 #define SYS_LINUX_SYSCALL_SUPPORT_H | 83 #define SYS_LINUX_SYSCALL_SUPPORT_H |
84 | 84 |
85 /* We currently only support x86-32, x86-64, ARM, MIPS, and PPC on Linux. | 85 /* We currently only support x86-32, x86-64, ARM, MIPS, PPC, s390 and s390x |
| 86 * on Linux. |
86 * Porting to other related platforms should not be difficult. | 87 * Porting to other related platforms should not be difficult. |
87 */ | 88 */ |
88 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ | 89 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
89 defined(__mips__) || defined(__PPC__) || defined(__ARM_EABI__) || \ | 90 defined(__mips__) || defined(__PPC__) || defined(__ARM_EABI__) || \ |
90 defined(__aarch64__)) \ | 91 defined(__aarch64__) || defined(__s390__)) \ |
91 && (defined(__linux) || defined(__ANDROID__)) | 92 && (defined(__linux) || defined(__ANDROID__)) |
92 | 93 |
93 #ifndef SYS_CPLUSPLUS | 94 #ifndef SYS_CPLUSPLUS |
94 #ifdef __cplusplus | 95 #ifdef __cplusplus |
95 /* Some system header files in older versions of gcc neglect to properly | 96 /* Some system header files in older versions of gcc neglect to properly |
96 * handle being included from C++. As it appears to be harmless to have | 97 * handle being included from C++. As it appears to be harmless to have |
97 * multiple nested 'extern "C"' blocks, just add another one here. | 98 * multiple nested 'extern "C"' blocks, just add another one here. |
98 */ | 99 */ |
99 extern "C" { | 100 extern "C" { |
100 #endif | 101 #endif |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 long ru_inblock; | 250 long ru_inblock; |
250 long ru_oublock; | 251 long ru_oublock; |
251 long ru_msgsnd; | 252 long ru_msgsnd; |
252 long ru_msgrcv; | 253 long ru_msgrcv; |
253 long ru_nsignals; | 254 long ru_nsignals; |
254 long ru_nvcsw; | 255 long ru_nvcsw; |
255 long ru_nivcsw; | 256 long ru_nivcsw; |
256 }; | 257 }; |
257 | 258 |
258 #if defined(__i386__) || defined(__ARM_EABI__) || defined(__ARM_ARCH_3__) \ | 259 #if defined(__i386__) || defined(__ARM_EABI__) || defined(__ARM_ARCH_3__) \ |
259 || defined(__PPC__) | 260 || defined(__PPC__) || (defined(__s390__) && !defined(__s390x__)) |
260 | 261 |
261 /* include/asm-{arm,i386,mips,ppc}/signal.h */ | 262 /* include/asm-{arm,i386,mips,ppc}/signal.h */ |
262 struct kernel_old_sigaction { | 263 struct kernel_old_sigaction { |
263 union { | 264 union { |
264 void (*sa_handler_)(int); | 265 void (*sa_handler_)(int); |
265 void (*sa_sigaction_)(int, siginfo_t *, void *); | 266 void (*sa_sigaction_)(int, siginfo_t *, void *); |
266 }; | 267 }; |
267 unsigned long sa_mask; | 268 unsigned long sa_mask; |
268 unsigned long sa_flags; | 269 unsigned long sa_flags; |
269 void (*sa_restorer)(void); | 270 void (*sa_restorer)(void); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 struct kernel_sigset_t sa_mask; | 315 struct kernel_sigset_t sa_mask; |
315 #endif | 316 #endif |
316 }; | 317 }; |
317 | 318 |
318 /* include/linux/socket.h */ | 319 /* include/linux/socket.h */ |
319 struct kernel_sockaddr { | 320 struct kernel_sockaddr { |
320 unsigned short sa_family; | 321 unsigned short sa_family; |
321 char sa_data[14]; | 322 char sa_data[14]; |
322 }; | 323 }; |
323 | 324 |
324 /* include/asm-{arm,aarch64,i386,mips,ppc}/stat.h */ | 325 /* include/asm-{arm,aarch64,i386,mips,ppc,s390}/stat.h */ |
325 #ifdef __mips__ | 326 #ifdef __mips__ |
326 #if _MIPS_SIM == _MIPS_SIM_ABI64 | 327 #if _MIPS_SIM == _MIPS_SIM_ABI64 |
327 struct kernel_stat { | 328 struct kernel_stat { |
328 #else | 329 #else |
329 struct kernel_stat64 { | 330 struct kernel_stat64 { |
330 #endif | 331 #endif |
331 unsigned st_dev; | 332 unsigned st_dev; |
332 unsigned __pad0[3]; | 333 unsigned __pad0[3]; |
333 unsigned long long st_ino; | 334 unsigned long long st_ino; |
334 unsigned st_mode; | 335 unsigned st_mode; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 unsigned st_atime_; | 388 unsigned st_atime_; |
388 unsigned st_atime_nsec_; | 389 unsigned st_atime_nsec_; |
389 unsigned st_mtime_; | 390 unsigned st_mtime_; |
390 unsigned st_mtime_nsec_; | 391 unsigned st_mtime_nsec_; |
391 unsigned st_ctime_; | 392 unsigned st_ctime_; |
392 unsigned st_ctime_nsec_; | 393 unsigned st_ctime_nsec_; |
393 unsigned long long st_ino; | 394 unsigned long long st_ino; |
394 }; | 395 }; |
395 #endif | 396 #endif |
396 | 397 |
397 /* include/asm-{arm,aarch64,i386,mips,x86_64,ppc}/stat.h */ | 398 /* include/asm-{arm,aarch64,i386,mips,x86_64,ppc,s390}/stat.h */ |
398 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) | 399 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) |
399 struct kernel_stat { | 400 struct kernel_stat { |
400 /* The kernel headers suggest that st_dev and st_rdev should be 32bit | 401 /* The kernel headers suggest that st_dev and st_rdev should be 32bit |
401 * quantities encoding 12bit major and 20bit minor numbers in an interleaved | 402 * quantities encoding 12bit major and 20bit minor numbers in an interleaved |
402 * format. In reality, we do not see useful data in the top bits. So, | 403 * format. In reality, we do not see useful data in the top bits. So, |
403 * we'll leave the padding in here, until we find a better solution. | 404 * we'll leave the padding in here, until we find a better solution. |
404 */ | 405 */ |
405 unsigned short st_dev; | 406 unsigned short st_dev; |
406 short pad1; | 407 short pad1; |
407 unsigned st_ino; | 408 unsigned st_ino; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 long st_blocks; | 505 long st_blocks; |
505 long st_atime_; | 506 long st_atime_; |
506 unsigned long st_atime_nsec_; | 507 unsigned long st_atime_nsec_; |
507 long st_mtime_; | 508 long st_mtime_; |
508 unsigned long st_mtime_nsec_; | 509 unsigned long st_mtime_nsec_; |
509 long st_ctime_; | 510 long st_ctime_; |
510 unsigned long st_ctime_nsec_; | 511 unsigned long st_ctime_nsec_; |
511 unsigned int __unused4; | 512 unsigned int __unused4; |
512 unsigned int __unused5; | 513 unsigned int __unused5; |
513 }; | 514 }; |
| 515 #elif defined(__s390x__) |
| 516 struct kernel_stat { |
| 517 unsigned long st_dev; |
| 518 unsigned long st_ino; |
| 519 unsigned long st_nlink; |
| 520 unsigned int st_mode; |
| 521 unsigned int st_uid; |
| 522 unsigned int st_gid; |
| 523 unsigned int __pad1; |
| 524 unsigned long st_rdev; |
| 525 unsigned long st_size; |
| 526 unsigned long st_atime_; |
| 527 unsigned long st_atime_nsec_; |
| 528 unsigned long st_mtime_; |
| 529 unsigned long st_mtime_nsec_; |
| 530 unsigned long st_ctime_; |
| 531 unsigned long st_ctime_nsec_; |
| 532 unsigned long st_blksize; |
| 533 long st_blocks; |
| 534 unsigned long __unused[3]; |
| 535 }; |
| 536 #elif defined(__s390__) |
| 537 struct kernel_stat { |
| 538 unsigned short st_dev; |
| 539 unsigned short __pad1; |
| 540 unsigned long st_ino; |
| 541 unsigned short st_mode; |
| 542 unsigned short st_nlink; |
| 543 unsigned short st_uid; |
| 544 unsigned short st_gid; |
| 545 unsigned short st_rdev; |
| 546 unsigned short __pad2; |
| 547 unsigned long st_size; |
| 548 unsigned long st_blksize; |
| 549 unsigned long st_blocks; |
| 550 unsigned long st_atime_; |
| 551 unsigned long st_atime_nsec_; |
| 552 unsigned long st_mtime_; |
| 553 unsigned long st_mtime_nsec_; |
| 554 unsigned long st_ctime_; |
| 555 unsigned long st_ctime_nsec_; |
| 556 unsigned long __unused4; |
| 557 unsigned long __unused5; |
| 558 }; |
514 #endif | 559 #endif |
515 | 560 |
516 /* include/asm-{arm,aarch64,i386,mips,x86_64,ppc}/statfs.h */ | 561 /* include/asm-{arm,aarch64,i386,mips,x86_64,ppc,s390}/statfs.h */ |
517 #ifdef __mips__ | 562 #ifdef __mips__ |
518 #if _MIPS_SIM != _MIPS_SIM_ABI64 | 563 #if _MIPS_SIM != _MIPS_SIM_ABI64 |
519 struct kernel_statfs64 { | 564 struct kernel_statfs64 { |
520 unsigned long f_type; | 565 unsigned long f_type; |
521 unsigned long f_bsize; | 566 unsigned long f_bsize; |
522 unsigned long f_frsize; | 567 unsigned long f_frsize; |
523 unsigned long __pad; | 568 unsigned long __pad; |
524 unsigned long long f_blocks; | 569 unsigned long long f_blocks; |
525 unsigned long long f_bfree; | 570 unsigned long long f_bfree; |
526 unsigned long long f_files; | 571 unsigned long long f_files; |
527 unsigned long long f_ffree; | 572 unsigned long long f_ffree; |
528 unsigned long long f_bavail; | 573 unsigned long long f_bavail; |
529 struct { int val[2]; } f_fsid; | 574 struct { int val[2]; } f_fsid; |
530 unsigned long f_namelen; | 575 unsigned long f_namelen; |
531 unsigned long f_spare[6]; | 576 unsigned long f_spare[6]; |
532 }; | 577 }; |
533 #endif | 578 #endif |
| 579 #elif defined(__s390__) |
| 580 /* See also arch/s390/include/asm/compat.h */ |
| 581 struct kernel_statfs64 { |
| 582 unsigned int f_type; |
| 583 unsigned int f_bsize; |
| 584 unsigned long long f_blocks; |
| 585 unsigned long long f_bfree; |
| 586 unsigned long long f_bavail; |
| 587 unsigned long long f_files; |
| 588 unsigned long long f_ffree; |
| 589 struct { int val[2]; } f_fsid; |
| 590 unsigned int f_namelen; |
| 591 unsigned int f_frsize; |
| 592 unsigned int f_flags; |
| 593 unsigned int f_spare[4]; |
| 594 }; |
534 #elif !defined(__x86_64__) | 595 #elif !defined(__x86_64__) |
535 struct kernel_statfs64 { | 596 struct kernel_statfs64 { |
536 unsigned long f_type; | 597 unsigned long f_type; |
537 unsigned long f_bsize; | 598 unsigned long f_bsize; |
538 unsigned long long f_blocks; | 599 unsigned long long f_blocks; |
539 unsigned long long f_bfree; | 600 unsigned long long f_bfree; |
540 unsigned long long f_bavail; | 601 unsigned long long f_bavail; |
541 unsigned long long f_files; | 602 unsigned long long f_files; |
542 unsigned long long f_ffree; | 603 unsigned long long f_ffree; |
543 struct { int val[2]; } f_fsid; | 604 struct { int val[2]; } f_fsid; |
544 unsigned long f_namelen; | 605 unsigned long f_namelen; |
545 unsigned long f_frsize; | 606 unsigned long f_frsize; |
546 unsigned long f_spare[5]; | 607 unsigned long f_spare[5]; |
547 }; | 608 }; |
548 #endif | 609 #endif |
549 | 610 |
550 /* include/asm-{arm,i386,mips,x86_64,ppc,generic}/statfs.h */ | 611 /* include/asm-{arm,i386,mips,x86_64,ppc,generic,s390}/statfs.h */ |
551 #ifdef __mips__ | 612 #ifdef __mips__ |
552 struct kernel_statfs { | 613 struct kernel_statfs { |
553 long f_type; | 614 long f_type; |
554 long f_bsize; | 615 long f_bsize; |
555 long f_frsize; | 616 long f_frsize; |
556 long f_blocks; | 617 long f_blocks; |
557 long f_bfree; | 618 long f_bfree; |
558 long f_files; | 619 long f_files; |
559 long f_ffree; | 620 long f_ffree; |
560 long f_bavail; | 621 long f_bavail; |
(...skipping 11 matching lines...) Expand all Loading... |
572 uint64_t f_blocks; | 633 uint64_t f_blocks; |
573 uint64_t f_bfree; | 634 uint64_t f_bfree; |
574 uint64_t f_bavail; | 635 uint64_t f_bavail; |
575 uint64_t f_files; | 636 uint64_t f_files; |
576 uint64_t f_ffree; | 637 uint64_t f_ffree; |
577 struct { int val[2]; } f_fsid; | 638 struct { int val[2]; } f_fsid; |
578 uint64_t f_namelen; | 639 uint64_t f_namelen; |
579 uint64_t f_frsize; | 640 uint64_t f_frsize; |
580 uint64_t f_spare[5]; | 641 uint64_t f_spare[5]; |
581 }; | 642 }; |
| 643 #elif defined(__s390__) |
| 644 struct kernel_statfs { |
| 645 unsigned int f_type; |
| 646 unsigned int f_bsize; |
| 647 unsigned long f_blocks; |
| 648 unsigned long f_bfree; |
| 649 unsigned long f_bavail; |
| 650 unsigned long f_files; |
| 651 unsigned long f_ffree; |
| 652 struct { int val[2]; } f_fsid; |
| 653 unsigned int f_namelen; |
| 654 unsigned int f_frsize; |
| 655 unsigned int f_flags; |
| 656 unsigned int f_spare[4]; |
| 657 }; |
582 #else | 658 #else |
583 struct kernel_statfs { | 659 struct kernel_statfs { |
584 unsigned long f_type; | 660 unsigned long f_type; |
585 unsigned long f_bsize; | 661 unsigned long f_bsize; |
586 unsigned long f_blocks; | 662 unsigned long f_blocks; |
587 unsigned long f_bfree; | 663 unsigned long f_bfree; |
588 unsigned long f_bavail; | 664 unsigned long f_bavail; |
589 unsigned long f_files; | 665 unsigned long f_files; |
590 unsigned long f_ffree; | 666 unsigned long f_ffree; |
591 struct { int val[2]; } f_fsid; | 667 struct { int val[2]; } f_fsid; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 #endif | 1020 #endif |
945 #ifndef __NR_ioprio_get | 1021 #ifndef __NR_ioprio_get |
946 #define __NR_ioprio_get (__NR_SYSCALL_BASE + 315) | 1022 #define __NR_ioprio_get (__NR_SYSCALL_BASE + 315) |
947 #endif | 1023 #endif |
948 #ifndef __NR_move_pages | 1024 #ifndef __NR_move_pages |
949 #define __NR_move_pages (__NR_SYSCALL_BASE + 344) | 1025 #define __NR_move_pages (__NR_SYSCALL_BASE + 344) |
950 #endif | 1026 #endif |
951 #ifndef __NR_getcpu | 1027 #ifndef __NR_getcpu |
952 #define __NR_getcpu (__NR_SYSCALL_BASE + 345) | 1028 #define __NR_getcpu (__NR_SYSCALL_BASE + 345) |
953 #endif | 1029 #endif |
954 /* End of ARM 3/EABI definitions
*/ | 1030 /* End of ARM 3/EABI definitions */ |
955 #elif defined(__aarch64__) | 1031 #elif defined(__aarch64__) |
956 #ifndef __NR_setxattr | 1032 #ifndef __NR_setxattr |
957 #define __NR_setxattr 5 | 1033 #define __NR_setxattr 5 |
958 #endif | 1034 #endif |
959 #ifndef __NR_lsetxattr | 1035 #ifndef __NR_lsetxattr |
960 #define __NR_lsetxattr 6 | 1036 #define __NR_lsetxattr 6 |
961 #endif | 1037 #endif |
962 #ifndef __NR_getxattr | 1038 #ifndef __NR_getxattr |
963 #define __NR_getxattr 8 | 1039 #define __NR_getxattr 8 |
964 #endif | 1040 #endif |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 #ifndef __NR_unlinkat | 1573 #ifndef __NR_unlinkat |
1498 #define __NR_unlinkat 292 | 1574 #define __NR_unlinkat 292 |
1499 #endif | 1575 #endif |
1500 #ifndef __NR_move_pages | 1576 #ifndef __NR_move_pages |
1501 #define __NR_move_pages 301 | 1577 #define __NR_move_pages 301 |
1502 #endif | 1578 #endif |
1503 #ifndef __NR_getcpu | 1579 #ifndef __NR_getcpu |
1504 #define __NR_getcpu 302 | 1580 #define __NR_getcpu 302 |
1505 #endif | 1581 #endif |
1506 /* End of powerpc defininitions */ | 1582 /* End of powerpc defininitions */ |
| 1583 #elif defined(__s390__) |
| 1584 #ifndef __NR_quotactl |
| 1585 #define __NR_quotactl 131 |
| 1586 #endif |
| 1587 #ifndef __NR_rt_sigreturn |
| 1588 #define __NR_rt_sigreturn 173 |
| 1589 #endif |
| 1590 #ifndef __NR_rt_sigaction |
| 1591 #define __NR_rt_sigaction 174 |
| 1592 #endif |
| 1593 #ifndef __NR_rt_sigprocmask |
| 1594 #define __NR_rt_sigprocmask 175 |
| 1595 #endif |
| 1596 #ifndef __NR_rt_sigpending |
| 1597 #define __NR_rt_sigpending 176 |
| 1598 #endif |
| 1599 #ifndef __NR_rt_sigsuspend |
| 1600 #define __NR_rt_sigsuspend 179 |
| 1601 #endif |
| 1602 #ifndef __NR_pread64 |
| 1603 #define __NR_pread64 180 |
| 1604 #endif |
| 1605 #ifndef __NR_pwrite64 |
| 1606 #define __NR_pwrite64 181 |
| 1607 #endif |
| 1608 #ifndef __NR_getdents64 |
| 1609 #define __NR_getdents64 220 |
| 1610 #endif |
| 1611 #ifndef __NR_readahead |
| 1612 #define __NR_readahead 222 |
| 1613 #endif |
| 1614 #ifndef __NR_setxattr |
| 1615 #define __NR_setxattr 224 |
| 1616 #endif |
| 1617 #ifndef __NR_lsetxattr |
| 1618 #define __NR_lsetxattr 225 |
| 1619 #endif |
| 1620 #ifndef __NR_getxattr |
| 1621 #define __NR_getxattr 227 |
| 1622 #endif |
| 1623 #ifndef __NR_lgetxattr |
| 1624 #define __NR_lgetxattr 228 |
| 1625 #endif |
| 1626 #ifndef __NR_listxattr |
| 1627 #define __NR_listxattr 230 |
| 1628 #endif |
| 1629 #ifndef __NR_llistxattr |
| 1630 #define __NR_llistxattr 231 |
| 1631 #endif |
| 1632 #ifndef __NR_gettid |
| 1633 #define __NR_gettid 236 |
| 1634 #endif |
| 1635 #ifndef __NR_tkill |
| 1636 #define __NR_tkill 237 |
| 1637 #endif |
| 1638 #ifndef __NR_futex |
| 1639 #define __NR_futex 238 |
| 1640 #endif |
| 1641 #ifndef __NR_sched_setaffinity |
| 1642 #define __NR_sched_setaffinity 239 |
| 1643 #endif |
| 1644 #ifndef __NR_sched_getaffinity |
| 1645 #define __NR_sched_getaffinity 240 |
| 1646 #endif |
| 1647 #ifndef __NR_set_tid_address |
| 1648 #define __NR_set_tid_address 252 |
| 1649 #endif |
| 1650 #ifndef __NR_clock_gettime |
| 1651 #define __NR_clock_gettime 260 |
| 1652 #endif |
| 1653 #ifndef __NR_clock_getres |
| 1654 #define __NR_clock_getres 261 |
| 1655 #endif |
| 1656 #ifndef __NR_statfs64 |
| 1657 #define __NR_statfs64 265 |
| 1658 #endif |
| 1659 #ifndef __NR_fstatfs64 |
| 1660 #define __NR_fstatfs64 266 |
| 1661 #endif |
| 1662 #ifndef __NR_ioprio_set |
| 1663 #define __NR_ioprio_set 282 |
| 1664 #endif |
| 1665 #ifndef __NR_ioprio_get |
| 1666 #define __NR_ioprio_get 283 |
| 1667 #endif |
| 1668 #ifndef __NR_openat |
| 1669 #define __NR_openat 288 |
| 1670 #endif |
| 1671 #ifndef __NR_unlinkat |
| 1672 #define __NR_unlinkat 294 |
| 1673 #endif |
| 1674 #ifndef __NR_move_pages |
| 1675 #define __NR_move_pages 310 |
| 1676 #endif |
| 1677 #ifndef __NR_getcpu |
| 1678 #define __NR_getcpu 311 |
| 1679 #endif |
| 1680 #ifndef __NR_fallocate |
| 1681 #define __NR_fallocate 314 |
| 1682 #endif |
| 1683 /* Some syscalls are named/numbered differently between s390 and s390x. */ |
| 1684 #ifdef __s390x__ |
| 1685 # ifndef __NR_getrlimit |
| 1686 # define __NR_getrlimit 191 |
| 1687 # endif |
| 1688 # ifndef __NR_setresuid |
| 1689 # define __NR_setresuid 208 |
| 1690 # endif |
| 1691 # ifndef __NR_getresuid |
| 1692 # define __NR_getresuid 209 |
| 1693 # endif |
| 1694 # ifndef __NR_setresgid |
| 1695 # define __NR_setresgid 210 |
| 1696 # endif |
| 1697 # ifndef __NR_getresgid |
| 1698 # define __NR_getresgid 211 |
| 1699 # endif |
| 1700 # ifndef __NR_setfsuid |
| 1701 # define __NR_setfsuid 215 |
| 1702 # endif |
| 1703 # ifndef __NR_setfsgid |
| 1704 # define __NR_setfsgid 216 |
| 1705 # endif |
| 1706 # ifndef __NR_fadvise64 |
| 1707 # define __NR_fadvise64 253 |
| 1708 # endif |
| 1709 # ifndef __NR_newfstatat |
| 1710 # define __NR_newfstatat 293 |
| 1711 # endif |
| 1712 #else /* __s390x__ */ |
| 1713 # ifndef __NR_getrlimit |
| 1714 # define __NR_getrlimit 76 |
| 1715 # endif |
| 1716 # ifndef __NR_setfsuid |
| 1717 # define __NR_setfsuid 138 |
| 1718 # endif |
| 1719 # ifndef __NR_setfsgid |
| 1720 # define __NR_setfsgid 139 |
| 1721 # endif |
| 1722 # ifndef __NR_setresuid |
| 1723 # define __NR_setresuid 164 |
| 1724 # endif |
| 1725 # ifndef __NR_getresuid |
| 1726 # define __NR_getresuid 165 |
| 1727 # endif |
| 1728 # ifndef __NR_setresgid |
| 1729 # define __NR_setresgid 170 |
| 1730 # endif |
| 1731 # ifndef __NR_getresgid |
| 1732 # define __NR_getresgid 171 |
| 1733 # endif |
| 1734 # ifndef __NR_ugetrlimit |
| 1735 # define __NR_ugetrlimit 191 |
| 1736 # endif |
| 1737 # ifndef __NR_mmap2 |
| 1738 # define __NR_mmap2 192 |
| 1739 # endif |
| 1740 # ifndef __NR_setresuid32 |
| 1741 # define __NR_setresuid32 208 |
| 1742 # endif |
| 1743 # ifndef __NR_getresuid32 |
| 1744 # define __NR_getresuid32 209 |
| 1745 # endif |
| 1746 # ifndef __NR_setresgid32 |
| 1747 # define __NR_setresgid32 210 |
| 1748 # endif |
| 1749 # ifndef __NR_getresgid32 |
| 1750 # define __NR_getresgid32 211 |
| 1751 # endif |
| 1752 # ifndef __NR_setfsuid32 |
| 1753 # define __NR_setfsuid32 215 |
| 1754 # endif |
| 1755 # ifndef __NR_setfsgid32 |
| 1756 # define __NR_setfsgid32 216 |
| 1757 # endif |
| 1758 # ifndef __NR_fadvise64_64 |
| 1759 # define __NR_fadvise64_64 264 |
| 1760 # endif |
| 1761 # ifndef __NR_fstatat64 |
| 1762 # define __NR_fstatat64 293 |
| 1763 # endif |
| 1764 #endif /* __s390__ */ |
| 1765 /* End of s390/s390x definitions */ |
1507 #endif | 1766 #endif |
1508 | 1767 |
1509 | 1768 |
1510 /* After forking, we must make sure to only call system calls. */ | 1769 /* After forking, we must make sure to only call system calls. */ |
1511 #if defined(__BOUNDED_POINTERS__) | 1770 #if defined(__BOUNDED_POINTERS__) |
1512 #error "Need to port invocations of syscalls for bounded ptrs" | 1771 #error "Need to port invocations of syscalls for bounded ptrs" |
1513 #else | 1772 #else |
1514 /* The core dumper and the thread lister get executed after threads | 1773 /* The core dumper and the thread lister get executed after threads |
1515 * have been suspended. As a consequence, we cannot call any functions | 1774 * have been suspended. As a consequence, we cannot call any functions |
1516 * that acquire locks. Unfortunately, libc wraps most system calls | 1775 * that acquire locks. Unfortunately, libc wraps most system calls |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 #elif defined(SYS_PREFIX) && SYS_PREFIX == 7 | 1819 #elif defined(SYS_PREFIX) && SYS_PREFIX == 7 |
1561 #define LSS_NAME(name) sys7_##name | 1820 #define LSS_NAME(name) sys7_##name |
1562 #elif defined(SYS_PREFIX) && SYS_PREFIX == 8 | 1821 #elif defined(SYS_PREFIX) && SYS_PREFIX == 8 |
1563 #define LSS_NAME(name) sys8_##name | 1822 #define LSS_NAME(name) sys8_##name |
1564 #elif defined(SYS_PREFIX) && SYS_PREFIX == 9 | 1823 #elif defined(SYS_PREFIX) && SYS_PREFIX == 9 |
1565 #define LSS_NAME(name) sys9_##name | 1824 #define LSS_NAME(name) sys9_##name |
1566 #endif | 1825 #endif |
1567 | 1826 |
1568 #undef LSS_RETURN | 1827 #undef LSS_RETURN |
1569 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) \ | 1828 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) \ |
1570 || defined(__ARM_EABI__) || defined(__aarch64__)) | 1829 || defined(__ARM_EABI__) || defined(__aarch64__) || defined(__s390__)) |
1571 /* Failing system calls return a negative result in the range of | 1830 /* Failing system calls return a negative result in the range of |
1572 * -1..-4095. These are "errno" values with the sign inverted. | 1831 * -1..-4095. These are "errno" values with the sign inverted. |
1573 */ | 1832 */ |
1574 #define LSS_RETURN(type, res) \ | 1833 #define LSS_RETURN(type, res) \ |
1575 do { \ | 1834 do { \ |
1576 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ | 1835 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ |
1577 LSS_ERRNO = -(res); \ | 1836 LSS_ERRNO = -(res); \ |
1578 res = -1; \ | 1837 res = -1; \ |
1579 } \ | 1838 } \ |
1580 return (type) (res); \ | 1839 return (type) (res); \ |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 */ | 2088 */ |
1830 "1:\n" | 2089 "1:\n" |
1831 : "=a" (__res) | 2090 : "=a" (__res) |
1832 : "0"(-EINVAL), "i"(__NR_clone), | 2091 : "0"(-EINVAL), "i"(__NR_clone), |
1833 "m"(fn), "m"(child_stack), "m"(flags), "m"(arg), | 2092 "m"(fn), "m"(child_stack), "m"(flags), "m"(arg), |
1834 "m"(parent_tidptr), "m"(newtls), "m"(child_tidptr) | 2093 "m"(parent_tidptr), "m"(newtls), "m"(child_tidptr) |
1835 : "esp", "memory", "ecx", "edx", "esi", "edi"); | 2094 : "esp", "memory", "ecx", "edx", "esi", "edi"); |
1836 LSS_RETURN(int, __res); | 2095 LSS_RETURN(int, __res); |
1837 } | 2096 } |
1838 | 2097 |
1839 #define __NR__fadvise64_64 __NR_fadvise64_64 | |
1840 LSS_INLINE _syscall6(int, _fadvise64_64, int, fd, | |
1841 unsigned, offset_lo, unsigned, offset_hi, | |
1842 unsigned, len_lo, unsigned, len_hi, | |
1843 int, advice) | |
1844 | |
1845 LSS_INLINE int LSS_NAME(fadvise64)(int fd, loff_t offset, | |
1846 loff_t len, int advice) { | |
1847 return LSS_NAME(_fadvise64_64)(fd, | |
1848 (unsigned)offset, (unsigned)(offset >>32), | |
1849 (unsigned)len, (unsigned)(len >> 32), | |
1850 advice); | |
1851 } | |
1852 | |
1853 #define __NR__fallocate __NR_fallocate | |
1854 LSS_INLINE _syscall6(int, _fallocate, int, fd, | |
1855 int, mode, | |
1856 unsigned, offset_lo, unsigned, offset_hi, | |
1857 unsigned, len_lo, unsigned, len_hi) | |
1858 | |
1859 LSS_INLINE int LSS_NAME(fallocate)(int fd, int mode, | |
1860 loff_t offset, loff_t len) { | |
1861 union { loff_t off; unsigned w[2]; } o = { offset }, l = { len }; | |
1862 return LSS_NAME(_fallocate)(fd, mode, o.w[0], o.w[1], l.w[0], l.w[1]); | |
1863 } | |
1864 | |
1865 LSS_INLINE _syscall1(int, set_thread_area, void *, u) | 2098 LSS_INLINE _syscall1(int, set_thread_area, void *, u) |
1866 LSS_INLINE _syscall1(int, get_thread_area, void *, u) | 2099 LSS_INLINE _syscall1(int, get_thread_area, void *, u) |
1867 | 2100 |
1868 LSS_INLINE void (*LSS_NAME(restore_rt)(void))(void) { | 2101 LSS_INLINE void (*LSS_NAME(restore_rt)(void))(void) { |
1869 /* On i386, the kernel does not know how to return from a signal | 2102 /* On i386, the kernel does not know how to return from a signal |
1870 * handler. Instead, it relies on user space to provide a | 2103 * handler. Instead, it relies on user space to provide a |
1871 * restorer function that calls the {rt_,}sigreturn() system call. | 2104 * restorer function that calls the {rt_,}sigreturn() system call. |
1872 * Unfortunately, we cannot just reference the glibc version of this | 2105 * Unfortunately, we cannot just reference the glibc version of this |
1873 * function, as glibc goes out of its way to make it inaccessible. | 2106 * function, as glibc goes out of its way to make it inaccessible. |
1874 */ | 2107 */ |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 "r"(LSS_SYSCALL_ARG(arg)), | 2375 "r"(LSS_SYSCALL_ARG(arg)), |
2143 "d"(LSS_SYSCALL_ARG(parent_tidptr)), | 2376 "d"(LSS_SYSCALL_ARG(parent_tidptr)), |
2144 "r"(LSS_SYSCALL_ARG(newtls)), | 2377 "r"(LSS_SYSCALL_ARG(newtls)), |
2145 "r"(LSS_SYSCALL_ARG(child_tidptr)) | 2378 "r"(LSS_SYSCALL_ARG(child_tidptr)) |
2146 : "rsp", "memory", "r8", "r10", "r11", "rcx"); | 2379 : "rsp", "memory", "r8", "r10", "r11", "rcx"); |
2147 } | 2380 } |
2148 LSS_RETURN(int, __res); | 2381 LSS_RETURN(int, __res); |
2149 } | 2382 } |
2150 LSS_INLINE _syscall2(int, arch_prctl, int, c, void *, a) | 2383 LSS_INLINE _syscall2(int, arch_prctl, int, c, void *, a) |
2151 | 2384 |
2152 /* Need to make sure loff_t isn't truncated to 32-bits under x32. */ | |
2153 LSS_INLINE int LSS_NAME(fadvise64)(int fd, loff_t offset, loff_t len, | |
2154 int advice) { | |
2155 LSS_BODY(4, int, fadvise64, LSS_SYSCALL_ARG(fd), (uint64_t)(offset), | |
2156 (uint64_t)(len), LSS_SYSCALL_ARG(advice)); | |
2157 } | |
2158 | |
2159 LSS_INLINE void (*LSS_NAME(restore_rt)(void))(void) { | 2385 LSS_INLINE void (*LSS_NAME(restore_rt)(void))(void) { |
2160 /* On x86-64, the kernel does not know how to return from | 2386 /* On x86-64, the kernel does not know how to return from |
2161 * a signal handler. Instead, it relies on user space to provide a | 2387 * a signal handler. Instead, it relies on user space to provide a |
2162 * restorer function that calls the rt_sigreturn() system call. | 2388 * restorer function that calls the rt_sigreturn() system call. |
2163 * Unfortunately, we cannot just reference the glibc version of this | 2389 * Unfortunately, we cannot just reference the glibc version of this |
2164 * function, as glibc goes out of its way to make it inaccessible. | 2390 * function, as glibc goes out of its way to make it inaccessible. |
2165 */ | 2391 */ |
2166 long long res; | 2392 long long res; |
2167 __asm__ __volatile__("jmp 2f\n" | 2393 __asm__ __volatile__("jmp 2f\n" |
2168 ".align 16\n" | 2394 ".align 16\n" |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2969 : "0" (-1), "1" (EINVAL), | 3195 : "0" (-1), "1" (EINVAL), |
2970 "i" (__NR_clone), "i" (__NR_exit), | 3196 "i" (__NR_clone), "i" (__NR_exit), |
2971 "r" (__fn), "r" (__cstack), "r" (__flags), | 3197 "r" (__fn), "r" (__cstack), "r" (__flags), |
2972 "r" (__arg), "r" (__ptidptr), "r" (__newtls), | 3198 "r" (__arg), "r" (__ptidptr), "r" (__newtls), |
2973 "r" (__ctidptr) | 3199 "r" (__ctidptr) |
2974 : "cr0", "cr1", "memory", "ctr", | 3200 : "cr0", "cr1", "memory", "ctr", |
2975 "r0", "r29", "r27", "r28"); | 3201 "r0", "r29", "r27", "r28"); |
2976 } | 3202 } |
2977 LSS_RETURN(int, __ret, __err); | 3203 LSS_RETURN(int, __ret, __err); |
2978 } | 3204 } |
| 3205 #elif defined(__s390__) |
| 3206 #undef LSS_REG |
| 3207 #define LSS_REG(r, a) register unsigned long __r##r __asm__("r"#r) = (unsign
ed long) a |
| 3208 #undef LSS_BODY |
| 3209 #define LSS_BODY(type, name, args...) \ |
| 3210 register unsigned long __nr __asm__("r1") \ |
| 3211 = (unsigned long)(__NR_##name); \ |
| 3212 register long __res_r2 __asm__("r2"); \ |
| 3213 long __res; \ |
| 3214 __asm__ __volatile__ \ |
| 3215 ("svc 0\n\t" \ |
| 3216 : "=d"(__res_r2) \ |
| 3217 : "d"(__nr), ## args \ |
| 3218 : "memory"); \ |
| 3219 __res = __res_r2; \ |
| 3220 LSS_RETURN(type, __res) |
| 3221 #undef _syscall0 |
| 3222 #define _syscall0(type, name) \ |
| 3223 type LSS_NAME(name)(void) { \ |
| 3224 LSS_BODY(type, name); \ |
| 3225 } |
| 3226 #undef _syscall1 |
| 3227 #define _syscall1(type, name, type1, arg1) \ |
| 3228 type LSS_NAME(name)(type1 arg1) { \ |
| 3229 LSS_REG(2, arg1); \ |
| 3230 LSS_BODY(type, name, "0"(__r2)); \ |
| 3231 } |
| 3232 #undef _syscall2 |
| 3233 #define _syscall2(type, name, type1, arg1, type2, arg2) \ |
| 3234 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ |
| 3235 LSS_REG(2, arg1); LSS_REG(3, arg2); \ |
| 3236 LSS_BODY(type, name, "0"(__r2), "d"(__r3)); \ |
| 3237 } |
| 3238 #undef _syscall3 |
| 3239 #define _syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ |
| 3240 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3) { \ |
| 3241 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ |
| 3242 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4)); \ |
| 3243 } |
| 3244 #undef _syscall4 |
| 3245 #define _syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, \ |
| 3246 type4, arg4) \ |
| 3247 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, \ |
| 3248 type4 arg4) { \ |
| 3249 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ |
| 3250 LSS_REG(5, arg4); \ |
| 3251 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4), \ |
| 3252 "d"(__r5)); \ |
| 3253 } |
| 3254 #undef _syscall5 |
| 3255 #define _syscall5(type, name, type1, arg1, type2, arg2, type3, arg3, \ |
| 3256 type4, arg4, type5, arg5) \ |
| 3257 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, \ |
| 3258 type4 arg4, type5 arg5) { \ |
| 3259 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ |
| 3260 LSS_REG(5, arg4); LSS_REG(6, arg5); \ |
| 3261 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4), \ |
| 3262 "d"(__r5), "d"(__r6)); \ |
| 3263 } |
| 3264 #undef _syscall6 |
| 3265 #define _syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, \ |
| 3266 type4, arg4, type5, arg5, type6, arg6) \ |
| 3267 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, \ |
| 3268 type4 arg4, type5 arg5, type6 arg6) { \ |
| 3269 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ |
| 3270 LSS_REG(5, arg4); LSS_REG(6, arg5); LSS_REG(7, arg6); \ |
| 3271 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4), \ |
| 3272 "d"(__r5), "d"(__r6), "d"(__r7)); \ |
| 3273 } |
| 3274 LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack, |
| 3275 int flags, void *arg, int *parent_tidptr, |
| 3276 void *newtls, int *child_tidptr) { |
| 3277 long __ret; |
| 3278 { |
| 3279 register int (*__fn)(void *) __asm__ ("r1") = fn; |
| 3280 register void *__cstack __asm__ ("r2") = child_stack; |
| 3281 register int __flags __asm__ ("r3") = flags; |
| 3282 register void *__arg __asm__ ("r0") = arg; |
| 3283 register int *__ptidptr __asm__ ("r4") = parent_tidptr; |
| 3284 register void *__newtls __asm__ ("r6") = newtls; |
| 3285 register int *__ctidptr __asm__ ("r5") = child_tidptr; |
| 3286 __asm__ __volatile__ ( |
| 3287 #ifndef __s390x__ |
| 3288 /* arg already in r0 */ |
| 3289 "ltr %4, %4\n\t" /* check fn, which is already in r1 */ |
| 3290 "jz 1f\n\t" /* NULL function pointer, return -EINVAL */ |
| 3291 "ltr %5, %5\n\t" /* check child_stack, which is already in r2 *
/ |
| 3292 "jz 1f\n\t" /* NULL stack pointer, return -EINVAL */ |
| 3293 /* flags already in r3 */ |
| 3294 /* parent_tidptr already in r4 */ |
| 3295 /* child_tidptr already in r5 */ |
| 3296 /* newtls already in r6 */ |
| 3297 "svc %2\n\t" /* invoke clone syscall */ |
| 3298 "ltr %0,%%r2\n\t" /* load return code into __ret and test */ |
| 3299 "jnz 1f\n\t" /* return to parent if non-zero */ |
| 3300 /* start child thread */ |
| 3301 "lr %%r2, %7\n\t" /* set first parameter to void *arg */ |
| 3302 "ahi %%r15, -96\n\t" /* make room on the stack for the save area */ |
| 3303 "xc 0(4,%%r15), 0(%%r15)\n\t" |
| 3304 "basr %%r14, %4\n\t" /* jump to fn */ |
| 3305 "svc %3\n" /* invoke exit syscall */ |
| 3306 "1:\n" |
| 3307 #else |
| 3308 /* arg already in r0 */ |
| 3309 "ltgr %4, %4\n\t" /* check fn, which is already in r1 */ |
| 3310 "jz 1f\n\t" /* NULL function pointer, return -EINVAL */ |
| 3311 "ltgr %5, %5\n\t" /* check child_stack, which is already in r2 *
/ |
| 3312 "jz 1f\n\t" /* NULL stack pointer, return -EINVAL */ |
| 3313 /* flags already in r3 */ |
| 3314 /* parent_tidptr already in r4 */ |
| 3315 /* child_tidptr already in r5 */ |
| 3316 /* newtls already in r6 */ |
| 3317 "svc %2\n\t" /* invoke clone syscall */ |
| 3318 "ltgr %0, %%r2\n\t" /* load return code into __ret and test */ |
| 3319 "jnz 1f\n\t" /* return to parent if non-zero */ |
| 3320 /* start child thread */ |
| 3321 "lgr %%r2, %7\n\t" /* set first parameter to void *arg */ |
| 3322 "aghi %%r15, -160\n\t" /* make room on the stack for the save area */ |
| 3323 "xc 0(8,%%r15), 0(%%r15)\n\t" |
| 3324 "basr %%r14, %4\n\t" /* jump to fn */ |
| 3325 "svc %3\n" /* invoke exit syscall */ |
| 3326 "1:\n" |
| 3327 #endif |
| 3328 : "=r" (__ret) |
| 3329 : "0" (-EINVAL), "i" (__NR_clone), "i" (__NR_exit), |
| 3330 "d" (__fn), "d" (__cstack), "d" (__flags), "d" (__arg), |
| 3331 "d" (__ptidptr), "d" (__newtls), "d" (__ctidptr) |
| 3332 : "cc", "r14", "memory" |
| 3333 ); |
| 3334 } |
| 3335 LSS_RETURN(int, __ret); |
| 3336 } |
2979 #endif | 3337 #endif |
2980 #define __NR__exit __NR_exit | 3338 #define __NR__exit __NR_exit |
2981 #define __NR__gettid __NR_gettid | 3339 #define __NR__gettid __NR_gettid |
2982 #define __NR__mremap __NR_mremap | 3340 #define __NR__mremap __NR_mremap |
2983 LSS_INLINE _syscall1(void *, brk, void *, e) | 3341 LSS_INLINE _syscall1(void *, brk, void *, e) |
2984 LSS_INLINE _syscall1(int, chdir, const char *,p) | 3342 LSS_INLINE _syscall1(int, chdir, const char *,p) |
2985 LSS_INLINE _syscall1(int, close, int, f) | 3343 LSS_INLINE _syscall1(int, close, int, f) |
2986 LSS_INLINE _syscall2(int, clock_getres, int, c, | 3344 LSS_INLINE _syscall2(int, clock_getres, int, c, |
2987 struct kernel_timespec*, t) | 3345 struct kernel_timespec*, t) |
2988 LSS_INLINE _syscall2(int, clock_gettime, int, c, | 3346 LSS_INLINE _syscall2(int, clock_gettime, int, c, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 const void*, m, size_t, l, | 3541 const void*, m, size_t, l, |
3184 int, f, | 3542 int, f, |
3185 const struct kernel_sockaddr*, a, int, t) | 3543 const struct kernel_sockaddr*, a, int, t) |
3186 LSS_INLINE _syscall2(int, shutdown, int, s, | 3544 LSS_INLINE _syscall2(int, shutdown, int, s, |
3187 int, h) | 3545 int, h) |
3188 LSS_INLINE _syscall3(int, socket, int, d, | 3546 LSS_INLINE _syscall3(int, socket, int, d, |
3189 int, t, int, p) | 3547 int, t, int, p) |
3190 LSS_INLINE _syscall4(int, socketpair, int, d, | 3548 LSS_INLINE _syscall4(int, socketpair, int, d, |
3191 int, t, int, p, int*, s) | 3549 int, t, int, p, int*, s) |
3192 #endif | 3550 #endif |
3193 #if defined(__x86_64__) | 3551 #if defined(__NR_fadvise64) |
| 3552 #if defined(__x86_64__) |
| 3553 /* Need to make sure loff_t isn't truncated to 32-bits under x32. */ |
| 3554 LSS_INLINE int LSS_NAME(fadvise64)(int fd, loff_t offset, loff_t len, |
| 3555 int advice) { |
| 3556 LSS_BODY(4, int, fadvise64, LSS_SYSCALL_ARG(fd), (uint64_t)(offset), |
| 3557 (uint64_t)(len), LSS_SYSCALL_ARG(advice)); |
| 3558 } |
| 3559 #else |
| 3560 LSS_INLINE _syscall4(int, fadvise64, |
| 3561 int, fd, loff_t, offset, loff_t, len, int, advice) |
| 3562 #endif |
| 3563 #elif defined(__i386__) |
| 3564 #define __NR__fadvise64_64 __NR_fadvise64_64 |
| 3565 LSS_INLINE _syscall6(int, _fadvise64_64, int, fd, |
| 3566 unsigned, offset_lo, unsigned, offset_hi, |
| 3567 unsigned, len_lo, unsigned, len_hi, |
| 3568 int, advice) |
| 3569 |
| 3570 LSS_INLINE int LSS_NAME(fadvise64)(int fd, loff_t offset, |
| 3571 loff_t len, int advice) { |
| 3572 return LSS_NAME(_fadvise64_64)(fd, |
| 3573 (unsigned)offset, (unsigned)(offset >>32), |
| 3574 (unsigned)len, (unsigned)(len >> 32), |
| 3575 advice); |
| 3576 } |
| 3577 |
| 3578 #elif defined(__s390__) && !defined(__s390x__) |
| 3579 #define __NR__fadvise64_64 __NR_fadvise64_64 |
| 3580 struct kernel_fadvise64_64_args { |
| 3581 int fd; |
| 3582 long long offset; |
| 3583 long long len; |
| 3584 int advice; |
| 3585 }; |
| 3586 |
| 3587 LSS_INLINE _syscall1(int, _fadvise64_64, |
| 3588 struct kernel_fadvise64_64_args *args) |
| 3589 |
| 3590 LSS_INLINE int LSS_NAME(fadvise64)(int fd, loff_t offset, |
| 3591 loff_t len, int advice) { |
| 3592 struct kernel_fadvise64_64_args args = { fd, offset, len, advice }; |
| 3593 return LSS_NAME(_fadvise64_64)(&args); |
| 3594 } |
| 3595 #endif |
| 3596 #if defined(__NR_fallocate) |
| 3597 #if defined(__x86_64__) |
3194 /* Need to make sure loff_t isn't truncated to 32-bits under x32. */ | 3598 /* Need to make sure loff_t isn't truncated to 32-bits under x32. */ |
3195 LSS_INLINE int LSS_NAME(fallocate)(int f, int mode, loff_t offset, | 3599 LSS_INLINE int LSS_NAME(fallocate)(int f, int mode, loff_t offset, |
3196 loff_t len) { | 3600 loff_t len) { |
3197 LSS_BODY(4, int, fallocate, LSS_SYSCALL_ARG(f), LSS_SYSCALL_ARG(mode), | 3601 LSS_BODY(4, int, fallocate, LSS_SYSCALL_ARG(f), LSS_SYSCALL_ARG(mode), |
3198 (uint64_t)(offset), (uint64_t)(len)); | 3602 (uint64_t)(offset), (uint64_t)(len)); |
3199 } | 3603 } |
| 3604 #elif defined(__i386__) || (defined(__s390__) && !defined(__s390x__)) |
| 3605 #define __NR__fallocate __NR_fallocate |
| 3606 LSS_INLINE _syscall6(int, _fallocate, int, fd, |
| 3607 int, mode, |
| 3608 unsigned, offset_lo, unsigned, offset_hi, |
| 3609 unsigned, len_lo, unsigned, len_hi) |
3200 | 3610 |
| 3611 LSS_INLINE int LSS_NAME(fallocate)(int fd, int mode, |
| 3612 loff_t offset, loff_t len) { |
| 3613 union { loff_t off; unsigned w[2]; } o = { offset }, l = { len }; |
| 3614 return LSS_NAME(_fallocate)(fd, mode, o.w[0], o.w[1], l.w[0], l.w[1]); |
| 3615 } |
| 3616 #else |
| 3617 LSS_INLINE _syscall4(int, fallocate, |
| 3618 int, f, int, mode, loff_t, offset, loff_t, len) |
| 3619 #endif |
| 3620 #endif |
| 3621 #if defined(__x86_64__) || defined(__s390x__) |
3201 LSS_INLINE int LSS_NAME(getresgid32)(gid_t *rgid, | 3622 LSS_INLINE int LSS_NAME(getresgid32)(gid_t *rgid, |
3202 gid_t *egid, | 3623 gid_t *egid, |
3203 gid_t *sgid) { | 3624 gid_t *sgid) { |
3204 return LSS_NAME(getresgid)(rgid, egid, sgid); | 3625 return LSS_NAME(getresgid)(rgid, egid, sgid); |
3205 } | 3626 } |
3206 | 3627 |
3207 LSS_INLINE int LSS_NAME(getresuid32)(uid_t *ruid, | 3628 LSS_INLINE int LSS_NAME(getresuid32)(uid_t *ruid, |
3208 uid_t *euid, | 3629 uid_t *euid, |
3209 uid_t *suid) { | 3630 uid_t *suid) { |
3210 return LSS_NAME(getresuid)(ruid, euid, suid); | 3631 return LSS_NAME(getresuid)(ruid, euid, suid); |
3211 } | 3632 } |
3212 | |
3213 /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ | |
3214 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, | |
3215 int64_t o) { | |
3216 LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), | |
3217 LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), | |
3218 LSS_SYSCALL_ARG(d), (uint64_t)(o)); | |
3219 } | |
3220 | |
3221 LSS_INLINE _syscall4(int, newfstatat, int, d, | 3633 LSS_INLINE _syscall4(int, newfstatat, int, d, |
3222 const char *, p, | 3634 const char *, p, |
3223 struct kernel_stat*, b, int, f) | 3635 struct kernel_stat*, b, int, f) |
3224 | 3636 |
3225 LSS_INLINE int LSS_NAME(setfsgid32)(gid_t gid) { | 3637 LSS_INLINE int LSS_NAME(setfsgid32)(gid_t gid) { |
3226 return LSS_NAME(setfsgid)(gid); | 3638 return LSS_NAME(setfsgid)(gid); |
3227 } | 3639 } |
3228 | 3640 |
3229 LSS_INLINE int LSS_NAME(setfsuid32)(uid_t uid) { | 3641 LSS_INLINE int LSS_NAME(setfsuid32)(uid_t uid) { |
3230 return LSS_NAME(setfsuid)(uid); | 3642 return LSS_NAME(setfsuid)(uid); |
3231 } | 3643 } |
3232 | 3644 |
3233 LSS_INLINE int LSS_NAME(setresgid32)(gid_t rgid, gid_t egid, gid_t sgid) { | 3645 LSS_INLINE int LSS_NAME(setresgid32)(gid_t rgid, gid_t egid, gid_t sgid) { |
3234 return LSS_NAME(setresgid)(rgid, egid, sgid); | 3646 return LSS_NAME(setresgid)(rgid, egid, sgid); |
3235 } | 3647 } |
3236 | 3648 |
3237 LSS_INLINE int LSS_NAME(setresuid32)(uid_t ruid, uid_t euid, uid_t suid) { | 3649 LSS_INLINE int LSS_NAME(setresuid32)(uid_t ruid, uid_t euid, uid_t suid) { |
3238 return LSS_NAME(setresuid)(ruid, euid, suid); | 3650 return LSS_NAME(setresuid)(ruid, euid, suid); |
3239 } | 3651 } |
3240 | 3652 |
3241 LSS_INLINE int LSS_NAME(sigaction)(int signum, | 3653 LSS_INLINE int LSS_NAME(sigaction)(int signum, |
3242 const struct kernel_sigaction *act, | 3654 const struct kernel_sigaction *act, |
3243 struct kernel_sigaction *oldact) { | 3655 struct kernel_sigaction *oldact) { |
| 3656 #if defined(__x86_64__) |
3244 /* On x86_64, the kernel requires us to always set our own | 3657 /* On x86_64, the kernel requires us to always set our own |
3245 * SA_RESTORER in order to be able to return from a signal handler. | 3658 * SA_RESTORER in order to be able to return from a signal handler. |
3246 * This function must have a "magic" signature that the "gdb" | 3659 * This function must have a "magic" signature that the "gdb" |
3247 * (and maybe the kernel?) can recognize. | 3660 * (and maybe the kernel?) can recognize. |
3248 */ | 3661 */ |
3249 if (act != NULL && !(act->sa_flags & SA_RESTORER)) { | 3662 if (act != NULL && !(act->sa_flags & SA_RESTORER)) { |
3250 struct kernel_sigaction a = *act; | 3663 struct kernel_sigaction a = *act; |
3251 a.sa_flags |= SA_RESTORER; | 3664 a.sa_flags |= SA_RESTORER; |
3252 a.sa_restorer = LSS_NAME(restore_rt)(); | 3665 a.sa_restorer = LSS_NAME(restore_rt)(); |
3253 return LSS_NAME(rt_sigaction)(signum, &a, oldact, | 3666 return LSS_NAME(rt_sigaction)(signum, &a, oldact, |
3254 (KERNEL_NSIG+7)/8); | 3667 (KERNEL_NSIG+7)/8); |
3255 } else { | 3668 } else |
| 3669 #endif |
3256 return LSS_NAME(rt_sigaction)(signum, act, oldact, | 3670 return LSS_NAME(rt_sigaction)(signum, act, oldact, |
3257 (KERNEL_NSIG+7)/8); | 3671 (KERNEL_NSIG+7)/8); |
3258 } | |
3259 } | 3672 } |
3260 | 3673 |
3261 LSS_INLINE int LSS_NAME(sigpending)(struct kernel_sigset_t *set) { | 3674 LSS_INLINE int LSS_NAME(sigpending)(struct kernel_sigset_t *set) { |
3262 return LSS_NAME(rt_sigpending)(set, (KERNEL_NSIG+7)/8); | 3675 return LSS_NAME(rt_sigpending)(set, (KERNEL_NSIG+7)/8); |
3263 } | 3676 } |
3264 | 3677 |
3265 LSS_INLINE int LSS_NAME(sigprocmask)(int how, | 3678 LSS_INLINE int LSS_NAME(sigprocmask)(int how, |
3266 const struct kernel_sigset_t *set, | 3679 const struct kernel_sigset_t *set, |
3267 struct kernel_sigset_t *oldset) { | 3680 struct kernel_sigset_t *oldset) { |
3268 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); | 3681 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); |
3269 } | 3682 } |
3270 | 3683 |
3271 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { | 3684 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { |
3272 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); | 3685 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); |
3273 } | 3686 } |
3274 #endif | 3687 #endif |
3275 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ | 3688 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
3276 defined(__ARM_EABI__) || defined(__aarch64__) || \ | 3689 defined(__ARM_EABI__) || defined(__aarch64__) || \ |
3277 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) | 3690 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) || \ |
| 3691 defined(__s390__) |
3278 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, | 3692 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, |
3279 int*, s, int, o, | 3693 int*, s, int, o, |
3280 struct kernel_rusage*, r) | 3694 struct kernel_rusage*, r) |
3281 | 3695 |
3282 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ | 3696 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ |
3283 return LSS_NAME(wait4)(pid, status, options, 0); | 3697 return LSS_NAME(wait4)(pid, status, options, 0); |
3284 } | 3698 } |
3285 #endif | 3699 #endif |
3286 #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) | 3700 #if defined(__NR_openat) |
3287 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) | 3701 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) |
| 3702 #endif |
| 3703 #if defined(__NR_unlinkat) |
3288 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) | 3704 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) |
3289 #endif | 3705 #endif |
3290 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) | 3706 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ |
| 3707 (defined(__s390__) && !defined(__s390x__)) |
3291 #define __NR__getresgid32 __NR_getresgid32 | 3708 #define __NR__getresgid32 __NR_getresgid32 |
3292 #define __NR__getresuid32 __NR_getresuid32 | 3709 #define __NR__getresuid32 __NR_getresuid32 |
3293 #define __NR__setfsgid32 __NR_setfsgid32 | 3710 #define __NR__setfsgid32 __NR_setfsgid32 |
3294 #define __NR__setfsuid32 __NR_setfsuid32 | 3711 #define __NR__setfsuid32 __NR_setfsuid32 |
3295 #define __NR__setresgid32 __NR_setresgid32 | 3712 #define __NR__setresgid32 __NR_setresgid32 |
3296 #define __NR__setresuid32 __NR_setresuid32 | 3713 #define __NR__setresuid32 __NR_setresuid32 |
3297 #if defined(__ARM_EABI__) | 3714 #if defined(__ARM_EABI__) |
3298 LSS_INLINE _syscall2(int, ugetrlimit, int, r, | 3715 LSS_INLINE _syscall2(int, ugetrlimit, int, r, |
3299 struct kernel_rlimit*, l) | 3716 struct kernel_rlimit*, l) |
3300 #endif | 3717 #endif |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3434 LSS_INLINE int LSS_NAME(sigismember)(struct kernel_sigset_t *set, | 3851 LSS_INLINE int LSS_NAME(sigismember)(struct kernel_sigset_t *set, |
3435 int signum) { | 3852 int signum) { |
3436 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { | 3853 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { |
3437 LSS_ERRNO = EINVAL; | 3854 LSS_ERRNO = EINVAL; |
3438 return -1; | 3855 return -1; |
3439 } else { | 3856 } else { |
3440 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & | 3857 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & |
3441 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); | 3858 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); |
3442 } | 3859 } |
3443 } | 3860 } |
3444 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 3861 #if defined(__i386__) || \ |
3445 defined(__ARM_EABI__) || \ | 3862 defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ |
3446 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || defined(__PPC__) | 3863 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ |
| 3864 defined(__PPC__) || \ |
| 3865 (defined(__s390__) && !defined(__s390x__)) |
3447 #define __NR__sigaction __NR_sigaction | 3866 #define __NR__sigaction __NR_sigaction |
3448 #define __NR__sigpending __NR_sigpending | 3867 #define __NR__sigpending __NR_sigpending |
3449 #define __NR__sigprocmask __NR_sigprocmask | 3868 #define __NR__sigprocmask __NR_sigprocmask |
3450 #define __NR__sigsuspend __NR_sigsuspend | 3869 #define __NR__sigsuspend __NR_sigsuspend |
3451 #define __NR__socketcall __NR_socketcall | 3870 #define __NR__socketcall __NR_socketcall |
3452 LSS_INLINE _syscall2(int, fstat64, int, f, | 3871 LSS_INLINE _syscall2(int, fstat64, int, f, |
3453 struct kernel_stat64 *, b) | 3872 struct kernel_stat64 *, b) |
3454 LSS_INLINE _syscall5(int, _llseek, uint, fd, | 3873 LSS_INLINE _syscall5(int, _llseek, uint, fd, |
3455 unsigned long, hi, unsigned long, lo, | 3874 unsigned long, hi, unsigned long, lo, |
3456 loff_t *, res, uint, wh) | 3875 loff_t *, res, uint, wh) |
3457 #if !defined(__ARM_EABI__) | 3876 #if defined(__s390__) && !defined(__s390x__) |
3458 LSS_INLINE _syscall1(void*, mmap, void*, a) | 3877 /* On s390, mmap2() arguments are passed in memory. */ |
3459 #endif | 3878 LSS_INLINE void* LSS_NAME(_mmap2)(void *s, size_t l, int p, int f, int d, |
3460 LSS_INLINE _syscall6(void*, mmap2, void*, s, | 3879 off_t o) { |
| 3880 unsigned long buf[6] = { (unsigned long) s, (unsigned long) l, |
| 3881 (unsigned long) p, (unsigned long) f, |
| 3882 (unsigned long) d, (unsigned long) o }; |
| 3883 LSS_REG(2, buf); |
| 3884 LSS_BODY(void*, mmap2, "0"(__r2)); |
| 3885 } |
| 3886 #else |
| 3887 #define __NR__mmap2 __NR_mmap2 |
| 3888 LSS_INLINE _syscall6(void*, _mmap2, void*, s, |
3461 size_t, l, int, p, | 3889 size_t, l, int, p, |
3462 int, f, int, d, | 3890 int, f, int, d, |
3463 off_t, o) | 3891 off_t, o) |
| 3892 #endif |
3464 LSS_INLINE _syscall3(int, _sigaction, int, s, | 3893 LSS_INLINE _syscall3(int, _sigaction, int, s, |
3465 const struct kernel_old_sigaction*, a, | 3894 const struct kernel_old_sigaction*, a, |
3466 struct kernel_old_sigaction*, o) | 3895 struct kernel_old_sigaction*, o) |
3467 LSS_INLINE _syscall1(int, _sigpending, unsigned long*, s) | 3896 LSS_INLINE _syscall1(int, _sigpending, unsigned long*, s) |
3468 LSS_INLINE _syscall3(int, _sigprocmask, int, h, | 3897 LSS_INLINE _syscall3(int, _sigprocmask, int, h, |
3469 const unsigned long*, s, | 3898 const unsigned long*, s, |
3470 unsigned long*, o) | 3899 unsigned long*, o) |
3471 #ifdef __PPC__ | 3900 #ifdef __PPC__ |
3472 LSS_INLINE _syscall1(int, _sigsuspend, unsigned long, s) | 3901 LSS_INLINE _syscall1(int, _sigsuspend, unsigned long, s) |
3473 #else | 3902 #else |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3575 LSS_ERRNO = olderrno; | 4004 LSS_ERRNO = olderrno; |
3576 rc = LSS_NAME(_sigsuspend)( | 4005 rc = LSS_NAME(_sigsuspend)( |
3577 #ifndef __PPC__ | 4006 #ifndef __PPC__ |
3578 set, 0, | 4007 set, 0, |
3579 #endif | 4008 #endif |
3580 set->sig[0]); | 4009 set->sig[0]); |
3581 } | 4010 } |
3582 return rc; | 4011 return rc; |
3583 } | 4012 } |
3584 #endif | 4013 #endif |
| 4014 #if defined(__i386__) || \ |
| 4015 defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ |
| 4016 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ |
| 4017 defined(__PPC__) || \ |
| 4018 (defined(__s390__) && !defined(__s390x__)) |
| 4019 /* On these architectures, implement mmap() with mmap2(). */ |
| 4020 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, |
| 4021 int64_t o) { |
| 4022 if (o % 4096) { |
| 4023 LSS_ERRNO = EINVAL; |
| 4024 return (void *) -1; |
| 4025 } |
| 4026 return LSS_NAME(_mmap2)(s, l, p, f, d, (o / 4096)); |
| 4027 } |
| 4028 #elif defined(__s390x__) |
| 4029 /* On s390x, mmap() arguments are passed in memory. */ |
| 4030 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, |
| 4031 int64_t o) { |
| 4032 unsigned long buf[6] = { (unsigned long) s, (unsigned long) l, |
| 4033 (unsigned long) p, (unsigned long) f, |
| 4034 (unsigned long) d, (unsigned long) o }; |
| 4035 LSS_REG(2, buf); |
| 4036 LSS_BODY(void*, mmap, "0"(__r2)); |
| 4037 } |
| 4038 #elif defined(__x86_64__) |
| 4039 /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ |
| 4040 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, |
| 4041 int64_t o) { |
| 4042 LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), |
| 4043 LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), |
| 4044 LSS_SYSCALL_ARG(d), (uint64_t)(o)); |
| 4045 } |
| 4046 #else |
| 4047 /* Remaining 64-bit architectures. */ |
| 4048 LSS_INLINE _syscall6(void*, mmap, void*, addr, size_t, length, int, prot, |
| 4049 int, flags, int, fd, int64_t, offset) |
| 4050 #endif |
3585 #if defined(__PPC__) | 4051 #if defined(__PPC__) |
3586 #undef LSS_SC_LOADARGS_0 | 4052 #undef LSS_SC_LOADARGS_0 |
3587 #define LSS_SC_LOADARGS_0(dummy...) | 4053 #define LSS_SC_LOADARGS_0(dummy...) |
3588 #undef LSS_SC_LOADARGS_1 | 4054 #undef LSS_SC_LOADARGS_1 |
3589 #define LSS_SC_LOADARGS_1(arg1) \ | 4055 #define LSS_SC_LOADARGS_1(arg1) \ |
3590 __sc_4 = (unsigned long) (arg1) | 4056 __sc_4 = (unsigned long) (arg1) |
3591 #undef LSS_SC_LOADARGS_2 | 4057 #undef LSS_SC_LOADARGS_2 |
3592 #define LSS_SC_LOADARGS_2(arg1, arg2) \ | 4058 #define LSS_SC_LOADARGS_2(arg1, arg2) \ |
3593 LSS_SC_LOADARGS_1(arg1); \ | 4059 LSS_SC_LOADARGS_1(arg1); \ |
3594 __sc_5 = (unsigned long) (arg2) | 4060 __sc_5 = (unsigned long) (arg2) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 msg, int, flags) | 4144 msg, int, flags) |
3679 LSS_INLINE _syscall6(ssize_t, sendto, int, s, const void*, buf, size_t,len, | 4145 LSS_INLINE _syscall6(ssize_t, sendto, int, s, const void*, buf, size_t,len, |
3680 int, flags, const struct kernel_sockaddr*, to, | 4146 int, flags, const struct kernel_sockaddr*, to, |
3681 unsigned int, tolen) | 4147 unsigned int, tolen) |
3682 LSS_INLINE _syscall2(int, shutdown, int, s, int, how) | 4148 LSS_INLINE _syscall2(int, shutdown, int, s, int, how) |
3683 LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol) | 4149 LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol) |
3684 LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol, | 4150 LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol, |
3685 int*, sv) | 4151 int*, sv) |
3686 #endif | 4152 #endif |
3687 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 4153 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
3688 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) | 4154 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ |
| 4155 defined(__s390__) |
3689 #define __NR__socketcall __NR_socketcall | 4156 #define __NR__socketcall __NR_socketcall |
3690 LSS_INLINE _syscall2(int, _socketcall, int, c, | 4157 LSS_INLINE _syscall2(int, _socketcall, int, c, |
3691 va_list, a) | 4158 va_list, a) |
3692 LSS_INLINE int LSS_NAME(socketcall)(int op, ...) { | 4159 LSS_INLINE int LSS_NAME(socketcall)(int op, ...) { |
3693 int rc; | 4160 int rc; |
3694 va_list ap; | 4161 va_list ap; |
3695 va_start(ap, op); | 4162 va_start(ap, op); |
3696 rc = LSS_NAME(_socketcall)(op, ap); | 4163 rc = LSS_NAME(_socketcall)(op, ap); |
3697 va_end(ap); | 4164 va_end(ap); |
3698 return rc; | 4165 return rc; |
(...skipping 23 matching lines...) Expand all Loading... |
3722 | 4189 |
3723 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { | 4190 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { |
3724 return LSS_NAME(socketcall)(1, domain, type, protocol); | 4191 return LSS_NAME(socketcall)(1, domain, type, protocol); |
3725 } | 4192 } |
3726 | 4193 |
3727 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, | 4194 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, |
3728 int sv[2]) { | 4195 int sv[2]) { |
3729 return LSS_NAME(socketcall)(8, d, type, protocol, sv); | 4196 return LSS_NAME(socketcall)(8, d, type, protocol, sv); |
3730 } | 4197 } |
3731 #endif | 4198 #endif |
3732 #if defined(__i386__) || defined(__PPC__) | 4199 #if defined(__NR_fstatat64) |
3733 LSS_INLINE _syscall4(int, fstatat64, int, d, | 4200 LSS_INLINE _syscall4(int, fstatat64, int, d, |
3734 const char *, p, | 4201 const char *, p, |
3735 struct kernel_stat64 *, b, int, f) | 4202 struct kernel_stat64 *, b, int, f) |
3736 #endif | 4203 #endif |
3737 #if defined(__i386__) || defined(__PPC__) || \ | 4204 #if defined(__i386__) || defined(__PPC__) || \ |
3738 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) | 4205 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) |
3739 LSS_INLINE _syscall3(pid_t, waitpid, pid_t, p, | 4206 LSS_INLINE _syscall3(pid_t, waitpid, pid_t, p, |
3740 int*, s, int, o) | 4207 int*, s, int, o) |
3741 #endif | 4208 #endif |
3742 #if defined(__mips__) | 4209 #if defined(__mips__) |
(...skipping 18 matching lines...) Expand all Loading... |
3761 p[1] = __v1; | 4228 p[1] = __v1; |
3762 return 0; | 4229 return 0; |
3763 } | 4230 } |
3764 } | 4231 } |
3765 #elif !defined(__aarch64__) | 4232 #elif !defined(__aarch64__) |
3766 // The unlink syscall has been deprecated on aarch64. We polyfill it below. | 4233 // The unlink syscall has been deprecated on aarch64. We polyfill it below. |
3767 LSS_INLINE _syscall1(int, pipe, int *, p) | 4234 LSS_INLINE _syscall1(int, pipe, int *, p) |
3768 #endif | 4235 #endif |
3769 /* TODO(csilvers): see if ppc can/should support this as well */ | 4236 /* TODO(csilvers): see if ppc can/should support this as well */ |
3770 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 4237 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
3771 defined(__ARM_EABI__) || \ | 4238 defined(__ARM_EABI__) || \ |
3772 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) | 4239 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) || \ |
| 4240 (defined(__s390__) && !defined(__s390x__)) |
3773 #define __NR__statfs64 __NR_statfs64 | 4241 #define __NR__statfs64 __NR_statfs64 |
3774 #define __NR__fstatfs64 __NR_fstatfs64 | 4242 #define __NR__fstatfs64 __NR_fstatfs64 |
3775 LSS_INLINE _syscall3(int, _statfs64, const char*, p, | 4243 LSS_INLINE _syscall3(int, _statfs64, const char*, p, |
3776 size_t, s,struct kernel_statfs64*, b) | 4244 size_t, s,struct kernel_statfs64*, b) |
3777 LSS_INLINE _syscall3(int, _fstatfs64, int, f, | 4245 LSS_INLINE _syscall3(int, _fstatfs64, int, f, |
3778 size_t, s,struct kernel_statfs64*, b) | 4246 size_t, s,struct kernel_statfs64*, b) |
3779 LSS_INLINE int LSS_NAME(statfs64)(const char *p, | 4247 LSS_INLINE int LSS_NAME(statfs64)(const char *p, |
3780 struct kernel_statfs64 *b) { | 4248 struct kernel_statfs64 *b) { |
3781 return LSS_NAME(_statfs64)(p, sizeof(*b), b); | 4249 return LSS_NAME(_statfs64)(p, sizeof(*b), b); |
3782 } | 4250 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3880 } | 4348 } |
3881 #elif defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64 | 4349 #elif defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64 |
3882 LSS_INLINE _syscall4(ssize_t, pread64, int, f, | 4350 LSS_INLINE _syscall4(ssize_t, pread64, int, f, |
3883 void *, b, size_t, c, | 4351 void *, b, size_t, c, |
3884 loff_t, o) | 4352 loff_t, o) |
3885 LSS_INLINE _syscall4(ssize_t, pwrite64, int, f, | 4353 LSS_INLINE _syscall4(ssize_t, pwrite64, int, f, |
3886 const void *, b, size_t, c, | 4354 const void *, b, size_t, c, |
3887 loff_t, o) | 4355 loff_t, o) |
3888 LSS_INLINE _syscall3(int, readahead, int, f, | 4356 LSS_INLINE _syscall3(int, readahead, int, f, |
3889 loff_t, o, unsigned, c) | 4357 loff_t, o, unsigned, c) |
3890 LSS_INLINE _syscall6(void *, mmap, void *, addr, size_t, length, int, prot, | |
3891 int, flags, int, fd, int64_t, offset) | |
3892 #else | 4358 #else |
3893 #define __NR__pread64 __NR_pread64 | 4359 #define __NR__pread64 __NR_pread64 |
3894 #define __NR__pwrite64 __NR_pwrite64 | 4360 #define __NR__pwrite64 __NR_pwrite64 |
3895 #define __NR__readahead __NR_readahead | 4361 #define __NR__readahead __NR_readahead |
3896 #if defined(__ARM_EABI__) || defined(__mips__) | 4362 #if defined(__ARM_EABI__) || defined(__mips__) |
3897 /* On ARM and MIPS, a 64-bit parameter has to be in an even-odd register | 4363 /* On ARM and MIPS, a 64-bit parameter has to be in an even-odd register |
3898 * pair. Hence these calls ignore their fourth argument (r3) so that their | 4364 * pair. Hence these calls ignore their fourth argument (r3) so that their |
3899 * fifth and sixth make such a pair (r4,r5). | 4365 * fifth and sixth make such a pair (r4,r5). |
3900 */ | 4366 */ |
3901 #define LSS_LLARG_PAD 0, | 4367 #define LSS_LLARG_PAD 0, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3938 } | 4404 } |
3939 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { | 4405 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { |
3940 union { loff_t off; unsigned arg[2]; } o = { off }; | 4406 union { loff_t off; unsigned arg[2]; } o = { off }; |
3941 return LSS_NAME(_readahead)(fd, LSS_LLARG_PAD o.arg[0], o.arg[1], len); | 4407 return LSS_NAME(_readahead)(fd, LSS_LLARG_PAD o.arg[0], o.arg[1], len); |
3942 } | 4408 } |
3943 #endif | 4409 #endif |
3944 #endif | 4410 #endif |
3945 | 4411 |
3946 #if defined(__aarch64__) | 4412 #if defined(__aarch64__) |
3947 LSS_INLINE _syscall3(int, dup3, int, s, int, d, int, f) | 4413 LSS_INLINE _syscall3(int, dup3, int, s, int, d, int, f) |
3948 LSS_INLINE _syscall6(void *, mmap, void *, addr, size_t, length, int, prot, | |
3949 int, flags, int, fd, int64_t, offset) | |
3950 LSS_INLINE _syscall4(int, newfstatat, int, dirfd, const char *, pathname, | 4414 LSS_INLINE _syscall4(int, newfstatat, int, dirfd, const char *, pathname, |
3951 struct kernel_stat *, buf, int, flags) | 4415 struct kernel_stat *, buf, int, flags) |
3952 LSS_INLINE _syscall2(int, pipe2, int *, pipefd, int, flags) | 4416 LSS_INLINE _syscall2(int, pipe2, int *, pipefd, int, flags) |
3953 LSS_INLINE _syscall5(int, ppoll, struct kernel_pollfd *, u, | 4417 LSS_INLINE _syscall5(int, ppoll, struct kernel_pollfd *, u, |
3954 unsigned int, n, const struct kernel_timespec *, t, | 4418 unsigned int, n, const struct kernel_timespec *, t, |
3955 const struct kernel_sigset_t *, sigmask, size_t, s) | 4419 const struct kernel_sigset_t *, sigmask, size_t, s) |
3956 LSS_INLINE _syscall4(int, readlinkat, int, d, const char *, p, char *, b, | 4420 LSS_INLINE _syscall4(int, readlinkat, int, d, const char *, p, char *, b, |
3957 size_t, s) | 4421 size_t, s) |
3958 #endif | 4422 #endif |
3959 | 4423 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4028 # pragma pop_macro("fstat64") | 4492 # pragma pop_macro("fstat64") |
4029 # pragma pop_macro("lstat64") | 4493 # pragma pop_macro("lstat64") |
4030 #endif | 4494 #endif |
4031 | 4495 |
4032 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 4496 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
4033 } | 4497 } |
4034 #endif | 4498 #endif |
4035 | 4499 |
4036 #endif | 4500 #endif |
4037 #endif | 4501 #endif |
OLD | NEW |