Chromium Code Reviews| 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_fadvise64 | |
| 1651 #define __NR_fadvise64 253 | |
| 1652 #endif | |
| 1653 #ifndef __NR_clock_gettime | |
| 1654 #define __NR_clock_gettime 260 | |
| 1655 #endif | |
| 1656 #ifndef __NR_clock_getres | |
| 1657 #define __NR_clock_getres 261 | |
| 1658 #endif | |
| 1659 #ifndef __NR_statfs64 | |
| 1660 #define __NR_statfs64 265 | |
| 1661 #endif | |
| 1662 #ifndef __NR_fstatfs64 | |
| 1663 #define __NR_fstatfs64 266 | |
| 1664 #endif | |
| 1665 #ifndef __NR_ioprio_set | |
| 1666 #define __NR_ioprio_set 282 | |
| 1667 #endif | |
| 1668 #ifndef __NR_ioprio_get | |
| 1669 #define __NR_ioprio_get 283 | |
| 1670 #endif | |
| 1671 #ifndef __NR_openat | |
| 1672 #define __NR_openat 288 | |
| 1673 #endif | |
| 1674 #ifndef __NR_unlinkat | |
| 1675 #define __NR_unlinkat 294 | |
| 1676 #endif | |
| 1677 #ifndef __NR_move_pages | |
| 1678 #define __NR_move_pages 310 | |
| 1679 #endif | |
| 1680 #ifndef __NR_getcpu | |
| 1681 #define __NR_getcpu 311 | |
| 1682 #endif | |
| 1683 #ifndef __NR_fallocate | |
| 1684 #define __NR_fallocate 314 | |
| 1685 #endif | |
| 1686 /* Some syscalls are named/numbered differently between s390 and s390x. */ | |
| 1687 #ifdef __s390x__ | |
| 1688 # ifndef __NR_getrlimit | |
| 1689 # define __NR_getrlimit 191 | |
| 1690 # endif | |
| 1691 # ifndef __NR_setresuid | |
| 1692 # define __NR_setresuid 208 | |
| 1693 # endif | |
| 1694 # ifndef __NR_getresuid | |
| 1695 # define __NR_getresuid 209 | |
| 1696 # endif | |
| 1697 # ifndef __NR_setresgid | |
| 1698 # define __NR_setresgid 210 | |
| 1699 # endif | |
| 1700 # ifndef __NR_getresgid | |
| 1701 # define __NR_getresgid 211 | |
| 1702 # endif | |
| 1703 # ifndef __NR_setfsuid | |
| 1704 # define __NR_setfsuid 215 | |
| 1705 # endif | |
| 1706 # ifndef __NR_setfsgid | |
| 1707 # define __NR_setfsgid 216 | |
| 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_fstatat64 | |
| 1759 # define __NR_fstatat64 293 | |
| 1760 # endif | |
| 1761 #endif /* __s390__ */ | |
| 1762 /* End of s390/s390x definitions */ | |
| 1507 #endif | 1763 #endif |
| 1508 | 1764 |
| 1509 | 1765 |
| 1510 /* After forking, we must make sure to only call system calls. */ | 1766 /* After forking, we must make sure to only call system calls. */ |
| 1511 #if defined(__BOUNDED_POINTERS__) | 1767 #if defined(__BOUNDED_POINTERS__) |
| 1512 #error "Need to port invocations of syscalls for bounded ptrs" | 1768 #error "Need to port invocations of syscalls for bounded ptrs" |
| 1513 #else | 1769 #else |
| 1514 /* The core dumper and the thread lister get executed after threads | 1770 /* The core dumper and the thread lister get executed after threads |
| 1515 * have been suspended. As a consequence, we cannot call any functions | 1771 * have been suspended. As a consequence, we cannot call any functions |
| 1516 * that acquire locks. Unfortunately, libc wraps most system calls | 1772 * 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 | 1816 #elif defined(SYS_PREFIX) && SYS_PREFIX == 7 |
| 1561 #define LSS_NAME(name) sys7_##name | 1817 #define LSS_NAME(name) sys7_##name |
| 1562 #elif defined(SYS_PREFIX) && SYS_PREFIX == 8 | 1818 #elif defined(SYS_PREFIX) && SYS_PREFIX == 8 |
| 1563 #define LSS_NAME(name) sys8_##name | 1819 #define LSS_NAME(name) sys8_##name |
| 1564 #elif defined(SYS_PREFIX) && SYS_PREFIX == 9 | 1820 #elif defined(SYS_PREFIX) && SYS_PREFIX == 9 |
| 1565 #define LSS_NAME(name) sys9_##name | 1821 #define LSS_NAME(name) sys9_##name |
| 1566 #endif | 1822 #endif |
| 1567 | 1823 |
| 1568 #undef LSS_RETURN | 1824 #undef LSS_RETURN |
| 1569 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) \ | 1825 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) \ |
| 1570 || defined(__ARM_EABI__) || defined(__aarch64__)) | 1826 || defined(__ARM_EABI__) || defined(__aarch64__) || defined(__s390__)) |
| 1571 /* Failing system calls return a negative result in the range of | 1827 /* Failing system calls return a negative result in the range of |
| 1572 * -1..-4095. These are "errno" values with the sign inverted. | 1828 * -1..-4095. These are "errno" values with the sign inverted. |
| 1573 */ | 1829 */ |
| 1574 #define LSS_RETURN(type, res) \ | 1830 #define LSS_RETURN(type, res) \ |
| 1575 do { \ | 1831 do { \ |
| 1576 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ | 1832 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ |
| 1577 LSS_ERRNO = -(res); \ | 1833 LSS_ERRNO = -(res); \ |
| 1578 res = -1; \ | 1834 res = -1; \ |
| 1579 } \ | 1835 } \ |
| 1580 return (type) (res); \ | 1836 return (type) (res); \ |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2969 : "0" (-1), "1" (EINVAL), | 3225 : "0" (-1), "1" (EINVAL), |
| 2970 "i" (__NR_clone), "i" (__NR_exit), | 3226 "i" (__NR_clone), "i" (__NR_exit), |
| 2971 "r" (__fn), "r" (__cstack), "r" (__flags), | 3227 "r" (__fn), "r" (__cstack), "r" (__flags), |
| 2972 "r" (__arg), "r" (__ptidptr), "r" (__newtls), | 3228 "r" (__arg), "r" (__ptidptr), "r" (__newtls), |
| 2973 "r" (__ctidptr) | 3229 "r" (__ctidptr) |
| 2974 : "cr0", "cr1", "memory", "ctr", | 3230 : "cr0", "cr1", "memory", "ctr", |
| 2975 "r0", "r29", "r27", "r28"); | 3231 "r0", "r29", "r27", "r28"); |
| 2976 } | 3232 } |
| 2977 LSS_RETURN(int, __ret, __err); | 3233 LSS_RETURN(int, __ret, __err); |
| 2978 } | 3234 } |
| 3235 #elif defined(__s390__) | |
| 3236 #undef LSS_REG | |
| 3237 #define LSS_REG(r, a) register unsigned long __r##r __asm__("r"#r) = (unsign ed long) a | |
| 3238 #undef LSS_BODY | |
| 3239 #define LSS_BODY(type, name, args...) \ | |
| 3240 register unsigned long __nr __asm__("r1") \ | |
| 3241 = (unsigned long)(__NR_##name); \ | |
| 3242 register long __res_r2 __asm__("r2"); \ | |
| 3243 long __res; \ | |
| 3244 __asm__ __volatile__ \ | |
| 3245 ("svc 0\n\t" \ | |
| 3246 : "=d"(__res_r2) \ | |
| 3247 : "d"(__nr), ## args \ | |
| 3248 : "memory"); \ | |
| 3249 __res = __res_r2; \ | |
| 3250 LSS_RETURN(type, __res) | |
| 3251 #undef _syscall0 | |
| 3252 #define _syscall0(type, name) \ | |
| 3253 type LSS_NAME(name)(void) { \ | |
| 3254 LSS_BODY(type, name); \ | |
| 3255 } | |
| 3256 #undef _syscall1 | |
| 3257 #define _syscall1(type, name, type1, arg1) \ | |
| 3258 type LSS_NAME(name)(type1 arg1) { \ | |
| 3259 LSS_REG(2, arg1); \ | |
| 3260 LSS_BODY(type, name, "0"(__r2)); \ | |
| 3261 } | |
| 3262 #undef _syscall2 | |
| 3263 #define _syscall2(type, name, type1, arg1, type2, arg2) \ | |
| 3264 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ | |
| 3265 LSS_REG(2, arg1); LSS_REG(3, arg2); \ | |
| 3266 LSS_BODY(type, name, "0"(__r2), "d"(__r3)); \ | |
| 3267 } | |
| 3268 #undef _syscall3 | |
| 3269 #define _syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ | |
| 3270 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3) { \ | |
| 3271 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ | |
| 3272 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4)); \ | |
| 3273 } | |
| 3274 #undef _syscall4 | |
| 3275 #define _syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, \ | |
| 3276 type4, arg4) \ | |
| 3277 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, \ | |
| 3278 type4 arg4) { \ | |
| 3279 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ | |
| 3280 LSS_REG(5, arg4); \ | |
| 3281 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4), \ | |
| 3282 "d"(__r5)); \ | |
| 3283 } | |
| 3284 #undef _syscall5 | |
| 3285 #define _syscall5(type, name, type1, arg1, type2, arg2, type3, arg3, \ | |
| 3286 type4, arg4, type5, arg5) \ | |
| 3287 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, \ | |
| 3288 type4 arg4, type5 arg5) { \ | |
| 3289 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ | |
| 3290 LSS_REG(5, arg4); LSS_REG(6, arg5); \ | |
| 3291 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4), \ | |
| 3292 "d"(__r5), "d"(__r6)); \ | |
| 3293 } | |
| 3294 #undef _syscall6 | |
| 3295 #define _syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, \ | |
| 3296 type4, arg4, type5, arg5, type6, arg6) \ | |
| 3297 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, \ | |
| 3298 type4 arg4, type5 arg5, type6 arg6) { \ | |
| 3299 LSS_REG(2, arg1); LSS_REG(3, arg2); LSS_REG(4, arg3); \ | |
| 3300 LSS_REG(5, arg4); LSS_REG(6, arg5); LSS_REG(7, arg6); \ | |
| 3301 LSS_BODY(type, name, "0"(__r2), "d"(__r3), "d"(__r4), \ | |
| 3302 "d"(__r5), "d"(__r6), "d"(__r7)); \ | |
| 3303 } | |
| 3304 LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack, | |
| 3305 int flags, void *arg, int *parent_tidptr, | |
| 3306 void *newtls, int *child_tidptr) { | |
| 3307 long __ret; | |
| 3308 { | |
| 3309 register int (*__fn)(void *) __asm__ ("r1") = fn; | |
| 3310 register void *__cstack __asm__ ("r2") = child_stack; | |
| 3311 register int __flags __asm__ ("r3") = flags; | |
| 3312 register void *__arg __asm__ ("r0") = arg; | |
| 3313 register int *__ptidptr __asm__ ("r4") = parent_tidptr; | |
| 3314 register void *__newtls __asm__ ("r6") = newtls; | |
| 3315 register int *__ctidptr __asm__ ("r5") = child_tidptr; | |
| 3316 __asm__ __volatile__ ( | |
| 3317 #ifndef __s390x__ | |
| 3318 /* arg already in r0 */ | |
| 3319 "ltr %4, %4\n\t" /* check fn, which is already in r1 */ | |
| 3320 "jz 1f\n\t" /* NULL function pointer, return -EINVAL */ | |
| 3321 "ltr %5, %5\n\t" /* check child_stack, which is already in r2 * / | |
| 3322 "jz 1f\n\t" /* NULL stack pointer, return -EINVAL */ | |
| 3323 /* flags already in r3 */ | |
| 3324 /* parent_tidptr already in r4 */ | |
| 3325 /* child_tidptr already in r5 */ | |
| 3326 /* newtls already in r6 */ | |
| 3327 "svc %2\n\t" /* invoke clone syscall */ | |
| 3328 "ltr %0,%%r2\n\t" /* load return code into __ret and test */ | |
| 3329 "jnz 1f\n\t" /* return to parent if non-zero */ | |
| 3330 /* start child thread */ | |
| 3331 "lr %%r2, %7\n\t" /* set first parameter to void *arg */ | |
| 3332 "ahi %%r15, -96\n\t" /* make room on the stack for the save area */ | |
| 3333 "xc 0(4,%%r15), 0(%%r15)\n\t" | |
| 3334 "basr %%r14, %4\n\t" /* jump to fn */ | |
| 3335 "svc %3\n" /* invoke exit syscall */ | |
| 3336 "1:\n" | |
| 3337 #else | |
| 3338 /* arg already in r0 */ | |
| 3339 "ltgr %4, %4\n\t" /* check fn, which is already in r1 */ | |
| 3340 "jz 1f\n\t" /* NULL function pointer, return -EINVAL */ | |
| 3341 "ltgr %5, %5\n\t" /* check child_stack, which is already in r2 * / | |
| 3342 "jz 1f\n\t" /* NULL stack pointer, return -EINVAL */ | |
| 3343 /* flags already in r3 */ | |
| 3344 /* parent_tidptr already in r4 */ | |
| 3345 /* child_tidptr already in r5 */ | |
| 3346 /* newtls already in r6 */ | |
| 3347 "svc %2\n\t" /* invoke clone syscall */ | |
| 3348 "ltgr %0, %%r2\n\t" /* load return code into __ret and test */ | |
| 3349 "jnz 1f\n\t" /* return to parent if non-zero */ | |
| 3350 /* start child thread */ | |
| 3351 "lgr %%r2, %7\n\t" /* set first parameter to void *arg */ | |
| 3352 "aghi %%r15, -160\n\t" /* make room on the stack for the save area */ | |
| 3353 "xc 0(8,%%r15), 0(%%r15)\n\t" | |
| 3354 "basr %%r14, %4\n\t" /* jump to fn */ | |
| 3355 "svc %3\n" /* invoke exit syscall */ | |
| 3356 "1:\n" | |
| 3357 #endif | |
| 3358 : "=r" (__ret) | |
| 3359 : "0" (-EINVAL), "i" (__NR_clone), "i" (__NR_exit), | |
| 3360 "d" (__fn), "d" (__cstack), "d" (__flags), "d" (__arg), | |
| 3361 "d" (__ptidptr), "d" (__newtls), "d" (__ctidptr) | |
| 3362 : "cc", "r14", "memory" | |
| 3363 ); | |
| 3364 } | |
| 3365 LSS_RETURN(int, __ret); | |
| 3366 } | |
| 2979 #endif | 3367 #endif |
| 2980 #define __NR__exit __NR_exit | 3368 #define __NR__exit __NR_exit |
| 2981 #define __NR__gettid __NR_gettid | 3369 #define __NR__gettid __NR_gettid |
| 2982 #define __NR__mremap __NR_mremap | 3370 #define __NR__mremap __NR_mremap |
| 2983 LSS_INLINE _syscall1(void *, brk, void *, e) | 3371 LSS_INLINE _syscall1(void *, brk, void *, e) |
| 2984 LSS_INLINE _syscall1(int, chdir, const char *,p) | 3372 LSS_INLINE _syscall1(int, chdir, const char *,p) |
| 2985 LSS_INLINE _syscall1(int, close, int, f) | 3373 LSS_INLINE _syscall1(int, close, int, f) |
| 2986 LSS_INLINE _syscall2(int, clock_getres, int, c, | 3374 LSS_INLINE _syscall2(int, clock_getres, int, c, |
| 2987 struct kernel_timespec*, t) | 3375 struct kernel_timespec*, t) |
| 2988 LSS_INLINE _syscall2(int, clock_gettime, int, c, | 3376 LSS_INLINE _syscall2(int, clock_gettime, int, c, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3190 LSS_INLINE _syscall4(int, socketpair, int, d, | 3578 LSS_INLINE _syscall4(int, socketpair, int, d, |
| 3191 int, t, int, p, int*, s) | 3579 int, t, int, p, int*, s) |
| 3192 #endif | 3580 #endif |
| 3193 #if defined(__x86_64__) | 3581 #if defined(__x86_64__) |
| 3194 /* Need to make sure loff_t isn't truncated to 32-bits under x32. */ | 3582 /* 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, | 3583 LSS_INLINE int LSS_NAME(fallocate)(int f, int mode, loff_t offset, |
| 3196 loff_t len) { | 3584 loff_t len) { |
| 3197 LSS_BODY(4, int, fallocate, LSS_SYSCALL_ARG(f), LSS_SYSCALL_ARG(mode), | 3585 LSS_BODY(4, int, fallocate, LSS_SYSCALL_ARG(f), LSS_SYSCALL_ARG(mode), |
| 3198 (uint64_t)(offset), (uint64_t)(len)); | 3586 (uint64_t)(offset), (uint64_t)(len)); |
| 3199 } | 3587 } |
| 3200 | 3588 #endif |
| 3589 #if defined(__s390__) | |
| 3590 LSS_INLINE _syscall4(int, fadvise64, | |
| 3591 int, fd, loff_t, offset, loff_t, len, int, advice) | |
|
vapier
2016/06/11 06:51:20
does this need to be s390-specific ? seems like t
bryanpkc
2016/06/11 20:45:35
We can define this for all 64-bit arches that have
| |
| 3592 LSS_INLINE _syscall4(int, fallocate, | |
|
vapier
2016/06/11 06:51:19
why doesn't the common one work ?
bryanpkc
2016/06/11 20:45:36
There was no common code for fallocate; the functi
| |
| 3593 int, f, int, mode, loff_t, offset, loff_t, len) | |
| 3594 #endif | |
| 3595 #if defined(__x86_64__) || defined(__s390x__) | |
| 3201 LSS_INLINE int LSS_NAME(getresgid32)(gid_t *rgid, | 3596 LSS_INLINE int LSS_NAME(getresgid32)(gid_t *rgid, |
| 3202 gid_t *egid, | 3597 gid_t *egid, |
| 3203 gid_t *sgid) { | 3598 gid_t *sgid) { |
| 3204 return LSS_NAME(getresgid)(rgid, egid, sgid); | 3599 return LSS_NAME(getresgid)(rgid, egid, sgid); |
| 3205 } | 3600 } |
| 3206 | 3601 |
| 3207 LSS_INLINE int LSS_NAME(getresuid32)(uid_t *ruid, | 3602 LSS_INLINE int LSS_NAME(getresuid32)(uid_t *ruid, |
| 3208 uid_t *euid, | 3603 uid_t *euid, |
| 3209 uid_t *suid) { | 3604 uid_t *suid) { |
| 3210 return LSS_NAME(getresuid)(ruid, euid, suid); | 3605 return LSS_NAME(getresuid)(ruid, euid, suid); |
| 3211 } | 3606 } |
| 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, | 3607 LSS_INLINE _syscall4(int, newfstatat, int, d, |
| 3222 const char *, p, | 3608 const char *, p, |
| 3223 struct kernel_stat*, b, int, f) | 3609 struct kernel_stat*, b, int, f) |
| 3224 | 3610 |
| 3225 LSS_INLINE int LSS_NAME(setfsgid32)(gid_t gid) { | 3611 LSS_INLINE int LSS_NAME(setfsgid32)(gid_t gid) { |
| 3226 return LSS_NAME(setfsgid)(gid); | 3612 return LSS_NAME(setfsgid)(gid); |
| 3227 } | 3613 } |
| 3228 | 3614 |
| 3229 LSS_INLINE int LSS_NAME(setfsuid32)(uid_t uid) { | 3615 LSS_INLINE int LSS_NAME(setfsuid32)(uid_t uid) { |
| 3230 return LSS_NAME(setfsuid)(uid); | 3616 return LSS_NAME(setfsuid)(uid); |
| 3231 } | 3617 } |
| 3232 | 3618 |
| 3233 LSS_INLINE int LSS_NAME(setresgid32)(gid_t rgid, gid_t egid, gid_t sgid) { | 3619 LSS_INLINE int LSS_NAME(setresgid32)(gid_t rgid, gid_t egid, gid_t sgid) { |
| 3234 return LSS_NAME(setresgid)(rgid, egid, sgid); | 3620 return LSS_NAME(setresgid)(rgid, egid, sgid); |
| 3235 } | 3621 } |
| 3236 | 3622 |
| 3237 LSS_INLINE int LSS_NAME(setresuid32)(uid_t ruid, uid_t euid, uid_t suid) { | 3623 LSS_INLINE int LSS_NAME(setresuid32)(uid_t ruid, uid_t euid, uid_t suid) { |
| 3238 return LSS_NAME(setresuid)(ruid, euid, suid); | 3624 return LSS_NAME(setresuid)(ruid, euid, suid); |
| 3239 } | 3625 } |
| 3240 | 3626 |
| 3241 LSS_INLINE int LSS_NAME(sigaction)(int signum, | 3627 LSS_INLINE int LSS_NAME(sigaction)(int signum, |
| 3242 const struct kernel_sigaction *act, | 3628 const struct kernel_sigaction *act, |
| 3243 struct kernel_sigaction *oldact) { | 3629 struct kernel_sigaction *oldact) { |
| 3630 #if defined(__x86_64__) | |
| 3244 /* On x86_64, the kernel requires us to always set our own | 3631 /* 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. | 3632 * SA_RESTORER in order to be able to return from a signal handler. |
| 3246 * This function must have a "magic" signature that the "gdb" | 3633 * This function must have a "magic" signature that the "gdb" |
| 3247 * (and maybe the kernel?) can recognize. | 3634 * (and maybe the kernel?) can recognize. |
| 3248 */ | 3635 */ |
| 3249 if (act != NULL && !(act->sa_flags & SA_RESTORER)) { | 3636 if (act != NULL && !(act->sa_flags & SA_RESTORER)) { |
| 3250 struct kernel_sigaction a = *act; | 3637 struct kernel_sigaction a = *act; |
| 3251 a.sa_flags |= SA_RESTORER; | 3638 a.sa_flags |= SA_RESTORER; |
| 3252 a.sa_restorer = LSS_NAME(restore_rt)(); | 3639 a.sa_restorer = LSS_NAME(restore_rt)(); |
| 3253 return LSS_NAME(rt_sigaction)(signum, &a, oldact, | 3640 return LSS_NAME(rt_sigaction)(signum, &a, oldact, |
| 3254 (KERNEL_NSIG+7)/8); | 3641 (KERNEL_NSIG+7)/8); |
| 3255 } else { | 3642 } else |
| 3643 #endif | |
| 3256 return LSS_NAME(rt_sigaction)(signum, act, oldact, | 3644 return LSS_NAME(rt_sigaction)(signum, act, oldact, |
| 3257 (KERNEL_NSIG+7)/8); | 3645 (KERNEL_NSIG+7)/8); |
| 3258 } | |
| 3259 } | 3646 } |
| 3260 | 3647 |
| 3261 LSS_INLINE int LSS_NAME(sigpending)(struct kernel_sigset_t *set) { | 3648 LSS_INLINE int LSS_NAME(sigpending)(struct kernel_sigset_t *set) { |
| 3262 return LSS_NAME(rt_sigpending)(set, (KERNEL_NSIG+7)/8); | 3649 return LSS_NAME(rt_sigpending)(set, (KERNEL_NSIG+7)/8); |
| 3263 } | 3650 } |
| 3264 | 3651 |
| 3265 LSS_INLINE int LSS_NAME(sigprocmask)(int how, | 3652 LSS_INLINE int LSS_NAME(sigprocmask)(int how, |
| 3266 const struct kernel_sigset_t *set, | 3653 const struct kernel_sigset_t *set, |
| 3267 struct kernel_sigset_t *oldset) { | 3654 struct kernel_sigset_t *oldset) { |
| 3268 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); | 3655 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); |
| 3269 } | 3656 } |
| 3270 | 3657 |
| 3271 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { | 3658 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { |
| 3272 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); | 3659 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); |
| 3273 } | 3660 } |
| 3274 #endif | 3661 #endif |
| 3275 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ | 3662 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
| 3276 defined(__ARM_EABI__) || defined(__aarch64__) || \ | 3663 defined(__ARM_EABI__) || defined(__aarch64__) || \ |
| 3277 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) | 3664 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) || \ |
| 3665 defined(__s390__) | |
| 3278 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, | 3666 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, |
| 3279 int*, s, int, o, | 3667 int*, s, int, o, |
| 3280 struct kernel_rusage*, r) | 3668 struct kernel_rusage*, r) |
| 3281 | 3669 |
| 3282 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ | 3670 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ |
| 3283 return LSS_NAME(wait4)(pid, status, options, 0); | 3671 return LSS_NAME(wait4)(pid, status, options, 0); |
| 3284 } | 3672 } |
| 3285 #endif | 3673 #endif |
| 3286 #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) | 3674 #if defined(__NR_openat) |
| 3287 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) | 3675 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) |
| 3676 #endif | |
| 3677 #if defined(__NR_unlinkat) | |
| 3288 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) | 3678 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) |
| 3289 #endif | 3679 #endif |
| 3290 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) | 3680 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ |
| 3681 (defined(__s390__) && !defined(__s390x__)) | |
| 3291 #define __NR__getresgid32 __NR_getresgid32 | 3682 #define __NR__getresgid32 __NR_getresgid32 |
| 3292 #define __NR__getresuid32 __NR_getresuid32 | 3683 #define __NR__getresuid32 __NR_getresuid32 |
| 3293 #define __NR__setfsgid32 __NR_setfsgid32 | 3684 #define __NR__setfsgid32 __NR_setfsgid32 |
| 3294 #define __NR__setfsuid32 __NR_setfsuid32 | 3685 #define __NR__setfsuid32 __NR_setfsuid32 |
| 3295 #define __NR__setresgid32 __NR_setresgid32 | 3686 #define __NR__setresgid32 __NR_setresgid32 |
| 3296 #define __NR__setresuid32 __NR_setresuid32 | 3687 #define __NR__setresuid32 __NR_setresuid32 |
| 3297 #if defined(__ARM_EABI__) | 3688 #if defined(__ARM_EABI__) |
| 3298 LSS_INLINE _syscall2(int, ugetrlimit, int, r, | 3689 LSS_INLINE _syscall2(int, ugetrlimit, int, r, |
| 3299 struct kernel_rlimit*, l) | 3690 struct kernel_rlimit*, l) |
| 3300 #endif | 3691 #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, | 3825 LSS_INLINE int LSS_NAME(sigismember)(struct kernel_sigset_t *set, |
| 3435 int signum) { | 3826 int signum) { |
| 3436 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { | 3827 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { |
| 3437 LSS_ERRNO = EINVAL; | 3828 LSS_ERRNO = EINVAL; |
| 3438 return -1; | 3829 return -1; |
| 3439 } else { | 3830 } else { |
| 3440 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & | 3831 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & |
| 3441 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); | 3832 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); |
| 3442 } | 3833 } |
| 3443 } | 3834 } |
| 3444 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 3835 #if defined(__i386__) || \ |
| 3445 defined(__ARM_EABI__) || \ | 3836 defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ |
| 3446 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || defined(__PPC__) | 3837 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ |
| 3838 defined(__PPC__) || \ | |
| 3839 (defined(__s390__) && !defined(__s390x__)) | |
| 3447 #define __NR__sigaction __NR_sigaction | 3840 #define __NR__sigaction __NR_sigaction |
| 3448 #define __NR__sigpending __NR_sigpending | 3841 #define __NR__sigpending __NR_sigpending |
| 3449 #define __NR__sigprocmask __NR_sigprocmask | 3842 #define __NR__sigprocmask __NR_sigprocmask |
| 3450 #define __NR__sigsuspend __NR_sigsuspend | 3843 #define __NR__sigsuspend __NR_sigsuspend |
| 3451 #define __NR__socketcall __NR_socketcall | 3844 #define __NR__socketcall __NR_socketcall |
| 3452 LSS_INLINE _syscall2(int, fstat64, int, f, | 3845 LSS_INLINE _syscall2(int, fstat64, int, f, |
| 3453 struct kernel_stat64 *, b) | 3846 struct kernel_stat64 *, b) |
| 3454 LSS_INLINE _syscall5(int, _llseek, uint, fd, | 3847 LSS_INLINE _syscall5(int, _llseek, uint, fd, |
| 3455 unsigned long, hi, unsigned long, lo, | 3848 unsigned long, hi, unsigned long, lo, |
| 3456 loff_t *, res, uint, wh) | 3849 loff_t *, res, uint, wh) |
| 3457 #if !defined(__ARM_EABI__) | 3850 #if defined(__s390__) && !defined(__s390x__) |
| 3458 LSS_INLINE _syscall1(void*, mmap, void*, a) | 3851 /* On s390, mmap2() arguments are passed in memory. */ |
| 3459 #endif | 3852 LSS_INLINE void* LSS_NAME(mmap2)(void *s, size_t l, int p, int f, int d, |
|
vapier
2016/06/11 06:51:20
we can just omit this entirely since mmap() does e
bryanpkc
2016/06/11 20:45:36
I think we need this to support 44-bit byte offset
| |
| 3853 off_t o) { | |
| 3854 unsigned long buf[6] = { (unsigned long) s, (unsigned long) l, | |
| 3855 (unsigned long) p, (unsigned long) f, | |
| 3856 (unsigned long) d, (unsigned long) o }; | |
| 3857 LSS_REG(2, buf); | |
| 3858 LSS_BODY(void*, mmap2, "0"(__r2)); | |
| 3859 } | |
| 3860 #else | |
| 3460 LSS_INLINE _syscall6(void*, mmap2, void*, s, | 3861 LSS_INLINE _syscall6(void*, mmap2, void*, s, |
| 3461 size_t, l, int, p, | 3862 size_t, l, int, p, |
| 3462 int, f, int, d, | 3863 int, f, int, d, |
| 3463 off_t, o) | 3864 off_t, o) |
| 3865 #endif | |
| 3464 LSS_INLINE _syscall3(int, _sigaction, int, s, | 3866 LSS_INLINE _syscall3(int, _sigaction, int, s, |
| 3465 const struct kernel_old_sigaction*, a, | 3867 const struct kernel_old_sigaction*, a, |
| 3466 struct kernel_old_sigaction*, o) | 3868 struct kernel_old_sigaction*, o) |
| 3467 LSS_INLINE _syscall1(int, _sigpending, unsigned long*, s) | 3869 LSS_INLINE _syscall1(int, _sigpending, unsigned long*, s) |
| 3468 LSS_INLINE _syscall3(int, _sigprocmask, int, h, | 3870 LSS_INLINE _syscall3(int, _sigprocmask, int, h, |
| 3469 const unsigned long*, s, | 3871 const unsigned long*, s, |
| 3470 unsigned long*, o) | 3872 unsigned long*, o) |
| 3471 #ifdef __PPC__ | 3873 #ifdef __PPC__ |
| 3472 LSS_INLINE _syscall1(int, _sigsuspend, unsigned long, s) | 3874 LSS_INLINE _syscall1(int, _sigsuspend, unsigned long, s) |
| 3473 #else | 3875 #else |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3575 LSS_ERRNO = olderrno; | 3977 LSS_ERRNO = olderrno; |
| 3576 rc = LSS_NAME(_sigsuspend)( | 3978 rc = LSS_NAME(_sigsuspend)( |
| 3577 #ifndef __PPC__ | 3979 #ifndef __PPC__ |
| 3578 set, 0, | 3980 set, 0, |
| 3579 #endif | 3981 #endif |
| 3580 set->sig[0]); | 3982 set->sig[0]); |
| 3581 } | 3983 } |
| 3582 return rc; | 3984 return rc; |
| 3583 } | 3985 } |
| 3584 #endif | 3986 #endif |
| 3987 #if defined(__i386__) || \ | |
| 3988 defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ | |
| 3989 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ | |
| 3990 defined(__PPC__) || \ | |
| 3991 (defined(__s390__) && !defined(__s390x__)) | |
| 3992 /* On these architectures, implement mmap() with mmap2(). */ | |
| 3993 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, | |
| 3994 int64_t o) { | |
| 3995 extern int __getpagesize(void); | |
| 3996 unsigned int pgsz = __getpagesize(); | |
|
vapier
2016/06/11 06:51:20
mmap2 is defined as always being shifted by 4096 b
bryanpkc
2016/06/11 20:45:36
Done.
| |
| 3997 if (o % pgsz) { | |
| 3998 LSS_ERRNO = EINVAL; | |
| 3999 return (void *) -1; | |
| 4000 } | |
| 4001 return LSS_NAME(mmap2)(s, l, p, f, d, (o / pgsz)); | |
| 4002 } | |
| 4003 #elif defined(__s390x__) | |
| 4004 /* On s390x, mmap() arguments are passed in memory. */ | |
| 4005 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, | |
| 4006 int64_t o) { | |
| 4007 unsigned long buf[6] = { (unsigned long) s, (unsigned long) l, | |
| 4008 (unsigned long) p, (unsigned long) f, | |
| 4009 (unsigned long) d, (unsigned long) o }; | |
| 4010 LSS_REG(2, buf); | |
| 4011 LSS_BODY(void*, mmap, "0"(__r2)); | |
| 4012 } | |
| 4013 #elif defined(__x86_64__) | |
| 4014 /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ | |
| 4015 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, | |
| 4016 int64_t o) { | |
| 4017 LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), | |
| 4018 LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), | |
| 4019 LSS_SYSCALL_ARG(d), (uint64_t)(o)); | |
| 4020 } | |
| 4021 #else | |
| 4022 /* aarch64 and MIPS64. */ | |
|
vapier
2016/06/11 06:51:20
i would say /* Remaining 64-bit arches. */
bryanpkc
2016/06/11 20:45:35
Done.
| |
| 4023 LSS_INLINE _syscall6(void*, mmap, void*, addr, size_t, length, int, prot, | |
| 4024 int, flags, int, fd, int64_t, offset) | |
| 4025 #endif | |
| 3585 #if defined(__PPC__) | 4026 #if defined(__PPC__) |
| 3586 #undef LSS_SC_LOADARGS_0 | 4027 #undef LSS_SC_LOADARGS_0 |
| 3587 #define LSS_SC_LOADARGS_0(dummy...) | 4028 #define LSS_SC_LOADARGS_0(dummy...) |
| 3588 #undef LSS_SC_LOADARGS_1 | 4029 #undef LSS_SC_LOADARGS_1 |
| 3589 #define LSS_SC_LOADARGS_1(arg1) \ | 4030 #define LSS_SC_LOADARGS_1(arg1) \ |
| 3590 __sc_4 = (unsigned long) (arg1) | 4031 __sc_4 = (unsigned long) (arg1) |
| 3591 #undef LSS_SC_LOADARGS_2 | 4032 #undef LSS_SC_LOADARGS_2 |
| 3592 #define LSS_SC_LOADARGS_2(arg1, arg2) \ | 4033 #define LSS_SC_LOADARGS_2(arg1, arg2) \ |
| 3593 LSS_SC_LOADARGS_1(arg1); \ | 4034 LSS_SC_LOADARGS_1(arg1); \ |
| 3594 __sc_5 = (unsigned long) (arg2) | 4035 __sc_5 = (unsigned long) (arg2) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3678 msg, int, flags) | 4119 msg, int, flags) |
| 3679 LSS_INLINE _syscall6(ssize_t, sendto, int, s, const void*, buf, size_t,len, | 4120 LSS_INLINE _syscall6(ssize_t, sendto, int, s, const void*, buf, size_t,len, |
| 3680 int, flags, const struct kernel_sockaddr*, to, | 4121 int, flags, const struct kernel_sockaddr*, to, |
| 3681 unsigned int, tolen) | 4122 unsigned int, tolen) |
| 3682 LSS_INLINE _syscall2(int, shutdown, int, s, int, how) | 4123 LSS_INLINE _syscall2(int, shutdown, int, s, int, how) |
| 3683 LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol) | 4124 LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol) |
| 3684 LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol, | 4125 LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol, |
| 3685 int*, sv) | 4126 int*, sv) |
| 3686 #endif | 4127 #endif |
| 3687 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 4128 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
| 3688 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) | 4129 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ |
| 4130 defined(__s390__) | |
| 3689 #define __NR__socketcall __NR_socketcall | 4131 #define __NR__socketcall __NR_socketcall |
| 3690 LSS_INLINE _syscall2(int, _socketcall, int, c, | 4132 LSS_INLINE _syscall2(int, _socketcall, int, c, |
| 3691 va_list, a) | 4133 va_list, a) |
| 3692 LSS_INLINE int LSS_NAME(socketcall)(int op, ...) { | 4134 LSS_INLINE int LSS_NAME(socketcall)(int op, ...) { |
| 3693 int rc; | 4135 int rc; |
| 3694 va_list ap; | 4136 va_list ap; |
| 3695 va_start(ap, op); | 4137 va_start(ap, op); |
| 3696 rc = LSS_NAME(_socketcall)(op, ap); | 4138 rc = LSS_NAME(_socketcall)(op, ap); |
| 3697 va_end(ap); | 4139 va_end(ap); |
| 3698 return rc; | 4140 return rc; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3722 | 4164 |
| 3723 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { | 4165 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { |
| 3724 return LSS_NAME(socketcall)(1, domain, type, protocol); | 4166 return LSS_NAME(socketcall)(1, domain, type, protocol); |
| 3725 } | 4167 } |
| 3726 | 4168 |
| 3727 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, | 4169 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, |
| 3728 int sv[2]) { | 4170 int sv[2]) { |
| 3729 return LSS_NAME(socketcall)(8, d, type, protocol, sv); | 4171 return LSS_NAME(socketcall)(8, d, type, protocol, sv); |
| 3730 } | 4172 } |
| 3731 #endif | 4173 #endif |
| 3732 #if defined(__i386__) || defined(__PPC__) | 4174 #if defined(__NR_fstatat64) |
| 3733 LSS_INLINE _syscall4(int, fstatat64, int, d, | 4175 LSS_INLINE _syscall4(int, fstatat64, int, d, |
| 3734 const char *, p, | 4176 const char *, p, |
| 3735 struct kernel_stat64 *, b, int, f) | 4177 struct kernel_stat64 *, b, int, f) |
| 3736 #endif | 4178 #endif |
| 3737 #if defined(__i386__) || defined(__PPC__) || \ | 4179 #if defined(__i386__) || defined(__PPC__) || \ |
| 3738 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) | 4180 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) |
| 3739 LSS_INLINE _syscall3(pid_t, waitpid, pid_t, p, | 4181 LSS_INLINE _syscall3(pid_t, waitpid, pid_t, p, |
| 3740 int*, s, int, o) | 4182 int*, s, int, o) |
| 3741 #endif | 4183 #endif |
| 3742 #if defined(__mips__) | 4184 #if defined(__mips__) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 3761 p[1] = __v1; | 4203 p[1] = __v1; |
| 3762 return 0; | 4204 return 0; |
| 3763 } | 4205 } |
| 3764 } | 4206 } |
| 3765 #elif !defined(__aarch64__) | 4207 #elif !defined(__aarch64__) |
| 3766 // The unlink syscall has been deprecated on aarch64. We polyfill it below. | 4208 // The unlink syscall has been deprecated on aarch64. We polyfill it below. |
| 3767 LSS_INLINE _syscall1(int, pipe, int *, p) | 4209 LSS_INLINE _syscall1(int, pipe, int *, p) |
| 3768 #endif | 4210 #endif |
| 3769 /* TODO(csilvers): see if ppc can/should support this as well */ | 4211 /* TODO(csilvers): see if ppc can/should support this as well */ |
| 3770 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 4212 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
| 3771 defined(__ARM_EABI__) || \ | 4213 defined(__ARM_EABI__) || \ |
| 3772 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) | 4214 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) || \ |
| 4215 (defined(__s390__) && !defined(__s390x__)) | |
| 3773 #define __NR__statfs64 __NR_statfs64 | 4216 #define __NR__statfs64 __NR_statfs64 |
| 3774 #define __NR__fstatfs64 __NR_fstatfs64 | 4217 #define __NR__fstatfs64 __NR_fstatfs64 |
| 3775 LSS_INLINE _syscall3(int, _statfs64, const char*, p, | 4218 LSS_INLINE _syscall3(int, _statfs64, const char*, p, |
| 3776 size_t, s,struct kernel_statfs64*, b) | 4219 size_t, s,struct kernel_statfs64*, b) |
| 3777 LSS_INLINE _syscall3(int, _fstatfs64, int, f, | 4220 LSS_INLINE _syscall3(int, _fstatfs64, int, f, |
| 3778 size_t, s,struct kernel_statfs64*, b) | 4221 size_t, s,struct kernel_statfs64*, b) |
| 3779 LSS_INLINE int LSS_NAME(statfs64)(const char *p, | 4222 LSS_INLINE int LSS_NAME(statfs64)(const char *p, |
| 3780 struct kernel_statfs64 *b) { | 4223 struct kernel_statfs64 *b) { |
| 3781 return LSS_NAME(_statfs64)(p, sizeof(*b), b); | 4224 return LSS_NAME(_statfs64)(p, sizeof(*b), b); |
| 3782 } | 4225 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3880 } | 4323 } |
| 3881 #elif defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64 | 4324 #elif defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64 |
| 3882 LSS_INLINE _syscall4(ssize_t, pread64, int, f, | 4325 LSS_INLINE _syscall4(ssize_t, pread64, int, f, |
| 3883 void *, b, size_t, c, | 4326 void *, b, size_t, c, |
| 3884 loff_t, o) | 4327 loff_t, o) |
| 3885 LSS_INLINE _syscall4(ssize_t, pwrite64, int, f, | 4328 LSS_INLINE _syscall4(ssize_t, pwrite64, int, f, |
| 3886 const void *, b, size_t, c, | 4329 const void *, b, size_t, c, |
| 3887 loff_t, o) | 4330 loff_t, o) |
| 3888 LSS_INLINE _syscall3(int, readahead, int, f, | 4331 LSS_INLINE _syscall3(int, readahead, int, f, |
| 3889 loff_t, o, unsigned, c) | 4332 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 | 4333 #else |
| 3893 #define __NR__pread64 __NR_pread64 | 4334 #define __NR__pread64 __NR_pread64 |
| 3894 #define __NR__pwrite64 __NR_pwrite64 | 4335 #define __NR__pwrite64 __NR_pwrite64 |
| 3895 #define __NR__readahead __NR_readahead | 4336 #define __NR__readahead __NR_readahead |
| 3896 #if defined(__ARM_EABI__) || defined(__mips__) | 4337 #if defined(__ARM_EABI__) || defined(__mips__) |
| 3897 /* On ARM and MIPS, a 64-bit parameter has to be in an even-odd register | 4338 /* 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 | 4339 * pair. Hence these calls ignore their fourth argument (r3) so that their |
| 3899 * fifth and sixth make such a pair (r4,r5). | 4340 * fifth and sixth make such a pair (r4,r5). |
| 3900 */ | 4341 */ |
| 3901 #define LSS_LLARG_PAD 0, | 4342 #define LSS_LLARG_PAD 0, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3938 } | 4379 } |
| 3939 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { | 4380 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { |
| 3940 union { loff_t off; unsigned arg[2]; } o = { off }; | 4381 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); | 4382 return LSS_NAME(_readahead)(fd, LSS_LLARG_PAD o.arg[0], o.arg[1], len); |
| 3942 } | 4383 } |
| 3943 #endif | 4384 #endif |
| 3944 #endif | 4385 #endif |
| 3945 | 4386 |
| 3946 #if defined(__aarch64__) | 4387 #if defined(__aarch64__) |
| 3947 LSS_INLINE _syscall3(int, dup3, int, s, int, d, int, f) | 4388 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, | 4389 LSS_INLINE _syscall4(int, newfstatat, int, dirfd, const char *, pathname, |
| 3951 struct kernel_stat *, buf, int, flags) | 4390 struct kernel_stat *, buf, int, flags) |
| 3952 LSS_INLINE _syscall2(int, pipe2, int *, pipefd, int, flags) | 4391 LSS_INLINE _syscall2(int, pipe2, int *, pipefd, int, flags) |
| 3953 LSS_INLINE _syscall5(int, ppoll, struct kernel_pollfd *, u, | 4392 LSS_INLINE _syscall5(int, ppoll, struct kernel_pollfd *, u, |
| 3954 unsigned int, n, const struct kernel_timespec *, t, | 4393 unsigned int, n, const struct kernel_timespec *, t, |
| 3955 const struct kernel_sigset_t *, sigmask, size_t, s) | 4394 const struct kernel_sigset_t *, sigmask, size_t, s) |
| 3956 LSS_INLINE _syscall4(int, readlinkat, int, d, const char *, p, char *, b, | 4395 LSS_INLINE _syscall4(int, readlinkat, int, d, const char *, p, char *, b, |
| 3957 size_t, s) | 4396 size_t, s) |
| 3958 #endif | 4397 #endif |
| 3959 | 4398 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4028 # pragma pop_macro("fstat64") | 4467 # pragma pop_macro("fstat64") |
| 4029 # pragma pop_macro("lstat64") | 4468 # pragma pop_macro("lstat64") |
| 4030 #endif | 4469 #endif |
| 4031 | 4470 |
| 4032 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 4471 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
| 4033 } | 4472 } |
| 4034 #endif | 4473 #endif |
| 4035 | 4474 |
| 4036 #endif | 4475 #endif |
| 4037 #endif | 4476 #endif |
| OLD | NEW |