OLD | NEW |
1 /* Copyright (c) 2005-2008, Google Inc. | 1 /* Copyright (c) 2005-2008, 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 * Do not access these symbols from outside this file. They are not part | 70 * Do not access these symbols from outside this file. They are not part |
71 * of the supported API. | 71 * of the supported API. |
72 */ | 72 */ |
73 #ifndef SYS_LINUX_SYSCALL_SUPPORT_H | 73 #ifndef SYS_LINUX_SYSCALL_SUPPORT_H |
74 #define SYS_LINUX_SYSCALL_SUPPORT_H | 74 #define SYS_LINUX_SYSCALL_SUPPORT_H |
75 | 75 |
76 /* We currently only support x86-32, x86-64, ARM, MIPS, and PPC on Linux. | 76 /* We currently only support x86-32, x86-64, ARM, MIPS, and PPC on Linux. |
77 * Porting to other related platforms should not be difficult. | 77 * Porting to other related platforms should not be difficult. |
78 */ | 78 */ |
79 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ | 79 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
80 defined(__mips__) || defined(__PPC__)) && defined(__linux) | 80 defined(__mips__) || defined(__PPC__) || defined(__ARM_EABI__)) \ |
| 81 && defined(__linux) |
81 | 82 |
82 #ifndef SYS_CPLUSPLUS | 83 #ifndef SYS_CPLUSPLUS |
83 #ifdef __cplusplus | 84 #ifdef __cplusplus |
84 /* Some system header files in older versions of gcc neglect to properly | 85 /* Some system header files in older versions of gcc neglect to properly |
85 * handle being included from C++. As it appears to be harmless to have | 86 * handle being included from C++. As it appears to be harmless to have |
86 * multiple nested 'extern "C"' blocks, just add another one here. | 87 * multiple nested 'extern "C"' blocks, just add another one here. |
87 */ | 88 */ |
88 extern "C" { | 89 extern "C" { |
89 #endif | 90 #endif |
90 | 91 |
91 #include <errno.h> | 92 #include <errno.h> |
92 #include <signal.h> | 93 #include <signal.h> |
93 #include <stdarg.h> | 94 #include <stdarg.h> |
94 #include <string.h> | 95 #include <string.h> |
95 #include <sys/ptrace.h> | 96 #include <sys/ptrace.h> |
96 #include <sys/resource.h> | 97 #include <sys/resource.h> |
97 #include <sys/time.h> | 98 #include <sys/time.h> |
98 #include <sys/types.h> | 99 #include <sys/types.h> |
99 #include <syscall.h> | 100 #include <syscall.h> |
100 #include <unistd.h> | 101 #include <unistd.h> |
101 #include <linux/unistd.h> | 102 #include <linux/unistd.h> |
102 #include <endian.h> | 103 #include <endian.h> |
103 | 104 |
104 #ifdef __mips__ | 105 #ifdef __mips__ |
105 /* Include definitions of the ABI currently in use. */ | 106 /* Include definitions of the ABI currently in use. */ |
106 #include <sgidefs.h> | 107 #include <sgidefs.h> |
107 #endif | 108 #endif |
108 | |
109 #endif | 109 #endif |
110 | 110 |
111 /* As glibc often provides subtly incompatible data structures (and implicit | 111 /* As glibc often provides subtly incompatible data structures (and implicit |
112 * wrapper functions that convert them), we provide our own kernel data | 112 * wrapper functions that convert them), we provide our own kernel data |
113 * structures for use by the system calls. | 113 * structures for use by the system calls. |
114 * These structures have been developed by using Linux 2.6.23 headers for | 114 * These structures have been developed by using Linux 2.6.23 headers for |
115 * reference. Note though, we do not care about exact API compatibility | 115 * reference. Note though, we do not care about exact API compatibility |
116 * with the kernel, and in fact the kernel often does not have a single | 116 * with the kernel, and in fact the kernel often does not have a single |
117 * API that works across architectures. Instead, we try to mimic the glibc | 117 * API that works across architectures. Instead, we try to mimic the glibc |
118 * API where reasonable, and only guarantee ABI compatibility with the | 118 * API where reasonable, and only guarantee ABI compatibility with the |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 long ru_inblock; | 210 long ru_inblock; |
211 long ru_oublock; | 211 long ru_oublock; |
212 long ru_msgsnd; | 212 long ru_msgsnd; |
213 long ru_msgrcv; | 213 long ru_msgrcv; |
214 long ru_nsignals; | 214 long ru_nsignals; |
215 long ru_nvcsw; | 215 long ru_nvcsw; |
216 long ru_nivcsw; | 216 long ru_nivcsw; |
217 }; | 217 }; |
218 | 218 |
219 struct siginfo; | 219 struct siginfo; |
220 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__PPC__) | 220 #if defined(__i386__) || defined(__ARM_EABI__) || defined(__ARM_ARCH_3__) \ |
| 221 || defined(__PPC__) |
221 | 222 |
222 /* include/asm-{arm,i386,mips,ppc}/signal.h */ | 223 /* include/asm-{arm,i386,mips,ppc}/signal.h */ |
223 struct kernel_old_sigaction { | 224 struct kernel_old_sigaction { |
224 union { | 225 union { |
225 void (*sa_handler_)(int); | 226 void (*sa_handler_)(int); |
226 void (*sa_sigaction_)(int, struct siginfo *, void *); | 227 void (*sa_sigaction_)(int, struct siginfo *, void *); |
227 }; | 228 }; |
228 unsigned long sa_mask; | 229 unsigned long sa_mask; |
229 unsigned long sa_flags; | 230 unsigned long sa_flags; |
230 void (*sa_restorer)(void); | 231 void (*sa_restorer)(void); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 unsigned st_atime_nsec_; | 348 unsigned st_atime_nsec_; |
348 unsigned st_mtime_; | 349 unsigned st_mtime_; |
349 unsigned st_mtime_nsec_; | 350 unsigned st_mtime_nsec_; |
350 unsigned st_ctime_; | 351 unsigned st_ctime_; |
351 unsigned st_ctime_nsec_; | 352 unsigned st_ctime_nsec_; |
352 unsigned long long st_ino; | 353 unsigned long long st_ino; |
353 }; | 354 }; |
354 #endif | 355 #endif |
355 | 356 |
356 /* include/asm-{arm,i386,mips,x86_64,ppc}/stat.h */ | 357 /* include/asm-{arm,i386,mips,x86_64,ppc}/stat.h */ |
357 #if defined(__i386__) || defined(__ARM_ARCH_3__) | 358 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) |
358 struct kernel_stat { | 359 struct kernel_stat { |
359 /* The kernel headers suggest that st_dev and st_rdev should be 32bit | 360 /* The kernel headers suggest that st_dev and st_rdev should be 32bit |
360 * quantities encoding 12bit major and 20bit minor numbers in an interleaved | 361 * quantities encoding 12bit major and 20bit minor numbers in an interleaved |
361 * format. In reality, we do not see useful data in the top bits. So, | 362 * format. In reality, we do not see useful data in the top bits. So, |
362 * we'll leave the padding in here, until we find a better solution. | 363 * we'll leave the padding in here, until we find a better solution. |
363 */ | 364 */ |
364 unsigned short st_dev; | 365 unsigned short st_dev; |
365 short pad1; | 366 short pad1; |
366 unsigned st_ino; | 367 unsigned st_ino; |
367 unsigned short st_mode; | 368 unsigned short st_mode; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 struct { int val[2]; } f_fsid; | 514 struct { int val[2]; } f_fsid; |
514 unsigned long f_namelen; | 515 unsigned long f_namelen; |
515 unsigned long f_frsize; | 516 unsigned long f_frsize; |
516 unsigned long f_spare[5]; | 517 unsigned long f_spare[5]; |
517 }; | 518 }; |
518 #endif | 519 #endif |
519 | 520 |
520 | 521 |
521 /* Definitions missing from the standard header files */ | 522 /* Definitions missing from the standard header files */ |
522 #ifndef O_DIRECTORY | 523 #ifndef O_DIRECTORY |
523 #if defined(__ARM_ARCH_3__) | 524 #if defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) |
524 #define O_DIRECTORY 0040000 | 525 #define O_DIRECTORY 0040000 |
525 #else | 526 #else |
526 #define O_DIRECTORY 0200000 | 527 #define O_DIRECTORY 0200000 |
527 #endif | 528 #endif |
528 #endif | 529 #endif |
529 #ifndef NT_PRXFPREG | 530 #ifndef NT_PRXFPREG |
530 #define NT_PRXFPREG 0x46e62b7f | 531 #define NT_PRXFPREG 0x46e62b7f |
531 #endif | 532 #endif |
532 #ifndef PTRACE_GETFPXREGS | 533 #ifndef PTRACE_GETFPXREGS |
533 #define PTRACE_GETFPXREGS ((enum __ptrace_request)18) | 534 #define PTRACE_GETFPXREGS ((enum __ptrace_request)18) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 #ifndef __NR_fstatat64 | 635 #ifndef __NR_fstatat64 |
635 #define __NR_fstatat64 300 | 636 #define __NR_fstatat64 300 |
636 #endif | 637 #endif |
637 #ifndef __NR_unlinkat | 638 #ifndef __NR_unlinkat |
638 #define __NR_unlinkat 301 | 639 #define __NR_unlinkat 301 |
639 #endif | 640 #endif |
640 #ifndef __NR_move_pages | 641 #ifndef __NR_move_pages |
641 #define __NR_move_pages 317 | 642 #define __NR_move_pages 317 |
642 #endif | 643 #endif |
643 /* End of i386 definitions */ | 644 /* End of i386 definitions */ |
644 #elif defined(__ARM_ARCH_3__) | 645 #elif defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) |
645 #ifndef __NR_setresuid | 646 #ifndef __NR_setresuid |
646 #define __NR_setresuid (__NR_SYSCALL_BASE + 164) | 647 #define __NR_setresuid (__NR_SYSCALL_BASE + 164) |
647 #define __NR_setresgid (__NR_SYSCALL_BASE + 170) | 648 #define __NR_setresgid (__NR_SYSCALL_BASE + 170) |
648 #endif | 649 #endif |
649 #ifndef __NR_rt_sigaction | 650 #ifndef __NR_rt_sigaction |
650 #define __NR_rt_sigaction (__NR_SYSCALL_BASE + 174) | 651 #define __NR_rt_sigaction (__NR_SYSCALL_BASE + 174) |
651 #define __NR_rt_sigprocmask (__NR_SYSCALL_BASE + 175) | 652 #define __NR_rt_sigprocmask (__NR_SYSCALL_BASE + 175) |
652 #define __NR_rt_sigpending (__NR_SYSCALL_BASE + 176) | 653 #define __NR_rt_sigpending (__NR_SYSCALL_BASE + 176) |
653 #define __NR_rt_sigsuspend (__NR_SYSCALL_BASE + 179) | 654 #define __NR_rt_sigsuspend (__NR_SYSCALL_BASE + 179) |
654 #endif | 655 #endif |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 #endif | 709 #endif |
709 #ifndef __NR_statfs64 | 710 #ifndef __NR_statfs64 |
710 #define __NR_statfs64 (__NR_SYSCALL_BASE + 266) | 711 #define __NR_statfs64 (__NR_SYSCALL_BASE + 266) |
711 #endif | 712 #endif |
712 #ifndef __NR_fstatfs64 | 713 #ifndef __NR_fstatfs64 |
713 #define __NR_fstatfs64 (__NR_SYSCALL_BASE + 267) | 714 #define __NR_fstatfs64 (__NR_SYSCALL_BASE + 267) |
714 #endif | 715 #endif |
715 #ifndef __NR_move_pages | 716 #ifndef __NR_move_pages |
716 #define __NR_move_pages (__NR_SYSCALL_BASE + 344) | 717 #define __NR_move_pages (__NR_SYSCALL_BASE + 344) |
717 #endif | 718 #endif |
718 /* End of ARM 3 definitions */ | 719 /* End of ARM 3/EABI definitions
*/ |
719 #elif defined(__x86_64__) | 720 #elif defined(__x86_64__) |
720 #ifndef __NR_setresuid | 721 #ifndef __NR_setresuid |
721 #define __NR_setresuid 117 | 722 #define __NR_setresuid 117 |
722 #define __NR_setresgid 119 | 723 #define __NR_setresgid 119 |
723 #endif | 724 #endif |
724 #ifndef __NR_gettid | 725 #ifndef __NR_gettid |
725 #define __NR_gettid 186 | 726 #define __NR_gettid 186 |
726 #endif | 727 #endif |
727 #ifndef __NR_readahead | 728 #ifndef __NR_readahead |
728 #define __NR_readahead 187 | 729 #define __NR_readahead 187 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 #define LSS_NAME(name) sys6_##name | 1081 #define LSS_NAME(name) sys6_##name |
1081 #elif SYS_PREFIX == 7 | 1082 #elif SYS_PREFIX == 7 |
1082 #define LSS_NAME(name) sys7_##name | 1083 #define LSS_NAME(name) sys7_##name |
1083 #elif SYS_PREFIX == 8 | 1084 #elif SYS_PREFIX == 8 |
1084 #define LSS_NAME(name) sys8_##name | 1085 #define LSS_NAME(name) sys8_##name |
1085 #elif SYS_PREFIX == 9 | 1086 #elif SYS_PREFIX == 9 |
1086 #define LSS_NAME(name) sys9_##name | 1087 #define LSS_NAME(name) sys9_##name |
1087 #endif | 1088 #endif |
1088 | 1089 |
1089 #undef LSS_RETURN | 1090 #undef LSS_RETURN |
1090 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__)) | 1091 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) \ |
| 1092 || defined(__ARM_EABI__)) |
1091 /* Failing system calls return a negative result in the range of | 1093 /* Failing system calls return a negative result in the range of |
1092 * -1..-4095. These are "errno" values with the sign inverted. | 1094 * -1..-4095. These are "errno" values with the sign inverted. |
1093 */ | 1095 */ |
1094 #define LSS_RETURN(type, res) \ | 1096 #define LSS_RETURN(type, res) \ |
1095 do { \ | 1097 do { \ |
1096 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ | 1098 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ |
1097 LSS_ERRNO = -(res); \ | 1099 LSS_ERRNO = -(res); \ |
1098 res = -1; \ | 1100 res = -1; \ |
1099 } \ | 1101 } \ |
1100 return (type) (res); \ | 1102 return (type) (res); \ |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 "0:.align 16\n" | 1521 "0:.align 16\n" |
1520 "1:movq %1,%%rax\n" | 1522 "1:movq %1,%%rax\n" |
1521 "syscall\n" | 1523 "syscall\n" |
1522 "2:popq %0\n" | 1524 "2:popq %0\n" |
1523 "addq $(1b-0b),%0\n" | 1525 "addq $(1b-0b),%0\n" |
1524 : "=a" (res) | 1526 : "=a" (res) |
1525 : "i" (__NR_rt_sigreturn)); | 1527 : "i" (__NR_rt_sigreturn)); |
1526 return res; | 1528 return res; |
1527 } | 1529 } |
1528 #elif defined(__ARM_ARCH_3__) | 1530 #elif defined(__ARM_ARCH_3__) |
1529 /* Most definitions of _syscallX() neglect to mark "memory" as being | |
1530 * clobbered. This causes problems with compilers, that do a better job | |
1531 * at optimizing across __asm__ calls. | |
1532 * So, we just have to redefine all fo the _syscallX() macros. | |
1533 */ | |
1534 #undef LSS_REG | 1531 #undef LSS_REG |
1535 #define LSS_REG(r,a) register long __r##r __asm__("r"#r) = (long)a | 1532 #define LSS_REG(r,a) register long __r##r __asm__("r"#r) = (long)a |
1536 #undef LSS_BODY | 1533 #undef LSS_BODY |
1537 #define LSS_BODY(type,name,args...) \ | 1534 #define LSS_BODY(type,name,args...) \ |
1538 register long __res_r0 __asm__("r0"); \ | 1535 register long __res_r0 __asm__("r0"); \ |
1539 long __res; \ | 1536 long __res; \ |
1540 __asm__ __volatile__ (__syscall(name) \ | 1537 __asm__ __volatile__ (__syscall(name) \ |
1541 : "=r"(__res_r0) : args : "lr", "memory"); \ | 1538 : "=r"(__res_r0) : args : "lr", "memory"); \ |
1542 __res = __res_r0; \ | 1539 __res = __res_r0; \ |
1543 LSS_RETURN(type, __res) | 1540 LSS_RETURN(type, __res) |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 __syscall(exit)"\n" | 1636 __syscall(exit)"\n" |
1640 "1:\n" | 1637 "1:\n" |
1641 : "=r" (__res) | 1638 : "=r" (__res) |
1642 : "i"(-EINVAL), | 1639 : "i"(-EINVAL), |
1643 "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), | 1640 "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), |
1644 "r"(__ptid), "r"(__tls), "r"(__ctid) | 1641 "r"(__ptid), "r"(__tls), "r"(__ctid) |
1645 : "lr", "memory"); | 1642 : "lr", "memory"); |
1646 } | 1643 } |
1647 LSS_RETURN(int, __res); | 1644 LSS_RETURN(int, __res); |
1648 } | 1645 } |
| 1646 #elif defined(__ARM_EABI__) |
| 1647 /* Most definitions of _syscallX() neglect to mark "memory" as being |
| 1648 * clobbered. This causes problems with compilers, that do a better job |
| 1649 * at optimizing across __asm__ calls. |
| 1650 * So, we just have to redefine all fo the _syscallX() macros. |
| 1651 */ |
| 1652 #undef LSS_REG |
| 1653 #define LSS_REG(r,a) register long __r##r __asm__("r"#r) = (long)a |
| 1654 #undef LSS_BODY |
| 1655 #define LSS_BODY(type,name,args...) \ |
| 1656 register long __res_r0 __asm__("r0"); \ |
| 1657 long __res; \ |
| 1658 __asm__ __volatile__ ("push {r7}\n" \ |
| 1659 "mov r7, %1\n" \ |
| 1660 "swi 0x0\n" \ |
| 1661 "pop {r7}\n" \ |
| 1662 : "=r"(__res_r0) \ |
| 1663 : "i"(__NR_##name) , ## args \ |
| 1664 : "lr", "memory"); \ |
| 1665 __res = __res_r0; \ |
| 1666 LSS_RETURN(type, __res) |
| 1667 #undef _syscall0 |
| 1668 #define _syscall0(type, name) \ |
| 1669 type LSS_NAME(name)() { \ |
| 1670 LSS_BODY(type, name); \ |
| 1671 } |
| 1672 #undef _syscall1 |
| 1673 #define _syscall1(type, name, type1, arg1) \ |
| 1674 type LSS_NAME(name)(type1 arg1) { \ |
| 1675 LSS_REG(0, arg1); LSS_BODY(type, name, "r"(__r0)); \ |
| 1676 } |
| 1677 #undef _syscall2 |
| 1678 #define _syscall2(type, name, type1, arg1, type2, arg2) \ |
| 1679 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ |
| 1680 LSS_REG(0, arg1); LSS_REG(1, arg2); \ |
| 1681 LSS_BODY(type, name, "r"(__r0), "r"(__r1)); \ |
| 1682 } |
| 1683 #undef _syscall3 |
| 1684 #define _syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ |
| 1685 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3) { \ |
| 1686 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ |
| 1687 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2)); \ |
| 1688 } |
| 1689 #undef _syscall4 |
| 1690 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ |
| 1691 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ |
| 1692 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ |
| 1693 LSS_REG(3, arg4); \ |
| 1694 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3)); \ |
| 1695 } |
| 1696 #undef _syscall5 |
| 1697 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ |
| 1698 type5,arg5) \ |
| 1699 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ |
| 1700 type5 arg5) { \ |
| 1701 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ |
| 1702 LSS_REG(3, arg4); LSS_REG(4, arg5); \ |
| 1703 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3), \ |
| 1704 "r"(__r4)); \ |
| 1705 } |
| 1706 #undef _syscall6 |
| 1707 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ |
| 1708 type5,arg5,type6,arg6) \ |
| 1709 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ |
| 1710 type5 arg5, type6 arg6) { \ |
| 1711 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ |
| 1712 LSS_REG(3, arg4); LSS_REG(4, arg5); LSS_REG(5, arg6); \ |
| 1713 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3), \ |
| 1714 "r"(__r4), "r"(__r5)); \ |
| 1715 } |
| 1716 LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack, |
| 1717 int flags, void *arg, int *parent_tidptr, |
| 1718 void *newtls, int *child_tidptr) { |
| 1719 long __res; |
| 1720 { |
| 1721 register int __flags __asm__("r0") = flags; |
| 1722 register void *__stack __asm__("r1") = child_stack; |
| 1723 register void *__ptid __asm__("r2") = parent_tidptr; |
| 1724 register void *__tls __asm__("r3") = newtls; |
| 1725 register int *__ctid __asm__("r4") = child_tidptr; |
| 1726 __asm__ __volatile__(/* if (fn == NULL || child_stack == NULL) |
| 1727 * return -EINVAL; |
| 1728 */ |
| 1729 "cmp %2,#0\n" |
| 1730 "cmpne %3,#0\n" |
| 1731 "moveq %0,%1\n" |
| 1732 "beq 1f\n" |
| 1733 |
| 1734 /* Push "arg" and "fn" onto the stack that will be |
| 1735 * used by the child. |
| 1736 */ |
| 1737 "str %5,[%3,#-4]!\n" |
| 1738 "str %2,[%3,#-4]!\n" |
| 1739 |
| 1740 /* %r0 = syscall(%r0 = flags, |
| 1741 * %r1 = child_stack, |
| 1742 * %r2 = parent_tidptr, |
| 1743 * %r3 = newtls, |
| 1744 * %r4 = child_tidptr) |
| 1745 */ |
| 1746 "mov r7, %9\n" |
| 1747 "swi 0x0\n" |
| 1748 |
| 1749 /* if (%r0 != 0) |
| 1750 * return %r0; |
| 1751 */ |
| 1752 "movs %0,r0\n" |
| 1753 "bne 1f\n" |
| 1754 |
| 1755 /* In the child, now. Call "fn(arg)". |
| 1756 */ |
| 1757 "ldr r0,[sp, #4]\n" |
| 1758 "mov lr,pc\n" |
| 1759 "ldr pc,[sp]\n" |
| 1760 |
| 1761 /* Call _exit(%r0). |
| 1762 */ |
| 1763 "mov r7, %10\n" |
| 1764 "swi 0x0\n" |
| 1765 "1:\n" |
| 1766 : "=r" (__res) |
| 1767 : "i"(-EINVAL), |
| 1768 "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), |
| 1769 "r"(__ptid), "r"(__tls), "r"(__ctid), |
| 1770 "i"(__NR_clone), "i"(__NR_exit) |
| 1771 : "lr", "memory"); |
| 1772 } |
| 1773 LSS_RETURN(int, __res); |
| 1774 } |
1649 #elif defined(__mips__) | 1775 #elif defined(__mips__) |
1650 #undef LSS_REG | 1776 #undef LSS_REG |
1651 #define LSS_REG(r,a) register unsigned long __r##r __asm__("$"#r) = \ | 1777 #define LSS_REG(r,a) register unsigned long __r##r __asm__("$"#r) = \ |
1652 (unsigned long)(a) | 1778 (unsigned long)(a) |
1653 #undef LSS_BODY | 1779 #undef LSS_BODY |
1654 #define LSS_BODY(type,name,r7,...) \ | 1780 #define LSS_BODY(type,name,r7,...) \ |
1655 register unsigned long __v0 __asm__("$2") = __NR_##name; \ | 1781 register unsigned long __v0 __asm__("$2") = __NR_##name; \ |
1656 __asm__ __volatile__ ("syscall\n" \ | 1782 __asm__ __volatile__ ("syscall\n" \ |
1657 : "=&r"(__v0), r7 (__r7) \ | 1783 : "=&r"(__v0), r7 (__r7) \ |
1658 : "0"(__v0), ##__VA_ARGS__ \ | 1784 : "0"(__v0), ##__VA_ARGS__ \ |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 struct kernel_dirent*, d, int, c) | 2201 struct kernel_dirent*, d, int, c) |
2076 LSS_INLINE _syscall3(int, getdents64, int, f, | 2202 LSS_INLINE _syscall3(int, getdents64, int, f, |
2077 struct kernel_dirent64*, d, int, c) | 2203 struct kernel_dirent64*, d, int, c) |
2078 LSS_INLINE _syscall0(gid_t, getegid) | 2204 LSS_INLINE _syscall0(gid_t, getegid) |
2079 LSS_INLINE _syscall0(uid_t, geteuid) | 2205 LSS_INLINE _syscall0(uid_t, geteuid) |
2080 LSS_INLINE _syscall0(pid_t, getpgrp) | 2206 LSS_INLINE _syscall0(pid_t, getpgrp) |
2081 LSS_INLINE _syscall0(pid_t, getpid) | 2207 LSS_INLINE _syscall0(pid_t, getpid) |
2082 LSS_INLINE _syscall0(pid_t, getppid) | 2208 LSS_INLINE _syscall0(pid_t, getppid) |
2083 LSS_INLINE _syscall2(int, getpriority, int, a, | 2209 LSS_INLINE _syscall2(int, getpriority, int, a, |
2084 int, b) | 2210 int, b) |
| 2211 #if !defined(__ARM_EABI__) |
2085 LSS_INLINE _syscall2(int, getrlimit, int, r, | 2212 LSS_INLINE _syscall2(int, getrlimit, int, r, |
2086 struct kernel_rlimit*, l) | 2213 struct kernel_rlimit*, l) |
| 2214 #endif |
2087 LSS_INLINE _syscall1(pid_t, getsid, pid_t, p) | 2215 LSS_INLINE _syscall1(pid_t, getsid, pid_t, p) |
2088 LSS_INLINE _syscall0(pid_t, _gettid) | 2216 LSS_INLINE _syscall0(pid_t, _gettid) |
2089 LSS_INLINE _syscall5(int, setxattr, const char *,p, | 2217 LSS_INLINE _syscall5(int, setxattr, const char *,p, |
2090 const char *, n, const void *,v, | 2218 const char *, n, const void *,v, |
2091 size_t, s, int, f) | 2219 size_t, s, int, f) |
2092 LSS_INLINE _syscall5(int, lsetxattr, const char *,p, | 2220 LSS_INLINE _syscall5(int, lsetxattr, const char *,p, |
2093 const char *, n, const void *,v, | 2221 const char *, n, const void *,v, |
2094 size_t, s, int, f) | 2222 size_t, s, int, f) |
2095 LSS_INLINE _syscall4(ssize_t, getxattr, const char *,p, | 2223 LSS_INLINE _syscall4(ssize_t, getxattr, const char *,p, |
2096 const char *, n, void *, v, size_t, s) | 2224 const char *, n, void *, v, size_t, s) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 const struct kernel_sigset_t *set, | 2358 const struct kernel_sigset_t *set, |
2231 struct kernel_sigset_t *oldset) { | 2359 struct kernel_sigset_t *oldset) { |
2232 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); | 2360 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); |
2233 } | 2361 } |
2234 | 2362 |
2235 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { | 2363 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { |
2236 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); | 2364 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); |
2237 } | 2365 } |
2238 #endif | 2366 #endif |
2239 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ | 2367 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
| 2368 defined(__ARM_EABI__) || \ |
2240 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) | 2369 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) |
2241 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, | 2370 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, |
2242 int*, s, int, o, | 2371 int*, s, int, o, |
2243 struct kernel_rusage*, r) | 2372 struct kernel_rusage*, r) |
2244 | 2373 |
2245 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ | 2374 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ |
2246 return LSS_NAME(wait4)(pid, status, options, 0); | 2375 return LSS_NAME(wait4)(pid, status, options, 0); |
2247 } | 2376 } |
2248 #endif | 2377 #endif |
2249 #if defined(__i386__) || defined(__x86_64__) | 2378 #if defined(__i386__) || defined(__x86_64__) |
2250 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) | 2379 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) |
2251 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) | 2380 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) |
2252 #endif | 2381 #endif |
2253 #if defined(__i386__) || defined(__ARM_ARCH_3__) | 2382 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) |
2254 #define __NR__setfsgid32 __NR_setfsgid32 | 2383 #define __NR__setfsgid32 __NR_setfsgid32 |
2255 #define __NR__setfsuid32 __NR_setfsuid32 | 2384 #define __NR__setfsuid32 __NR_setfsuid32 |
2256 #define __NR__setresgid32 __NR_setresgid32 | 2385 #define __NR__setresgid32 __NR_setresgid32 |
2257 #define __NR__setresuid32 __NR_setresuid32 | 2386 #define __NR__setresuid32 __NR_setresuid32 |
| 2387 #if defined(__ARM_EABI__) |
2258 LSS_INLINE _syscall2(int, ugetrlimit, int, r, | 2388 LSS_INLINE _syscall2(int, ugetrlimit, int, r, |
2259 struct kernel_rlimit*, l) | 2389 struct kernel_rlimit*, l) |
| 2390 #endif |
2260 LSS_INLINE _syscall1(int, _setfsgid32, gid_t, f) | 2391 LSS_INLINE _syscall1(int, _setfsgid32, gid_t, f) |
2261 LSS_INLINE _syscall1(int, _setfsuid32, uid_t, f) | 2392 LSS_INLINE _syscall1(int, _setfsuid32, uid_t, f) |
2262 LSS_INLINE _syscall3(int, _setresgid32, gid_t, r, | 2393 LSS_INLINE _syscall3(int, _setresgid32, gid_t, r, |
2263 gid_t, e, gid_t, s) | 2394 gid_t, e, gid_t, s) |
2264 LSS_INLINE _syscall3(int, _setresuid32, uid_t, r, | 2395 LSS_INLINE _syscall3(int, _setresuid32, uid_t, r, |
2265 uid_t, e, uid_t, s) | 2396 uid_t, e, uid_t, s) |
2266 | 2397 |
2267 LSS_INLINE int LSS_NAME(setfsgid32)(gid_t gid) { | 2398 LSS_INLINE int LSS_NAME(setfsgid32)(gid_t gid) { |
2268 int rc; | 2399 int rc; |
2269 if ((rc = LSS_NAME(_setfsgid32)(gid)) < 0 && | 2400 if ((rc = LSS_NAME(_setfsgid32)(gid)) < 0 && |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 int signum) { | 2489 int signum) { |
2359 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { | 2490 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { |
2360 LSS_ERRNO = EINVAL; | 2491 LSS_ERRNO = EINVAL; |
2361 return -1; | 2492 return -1; |
2362 } else { | 2493 } else { |
2363 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & | 2494 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & |
2364 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); | 2495 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); |
2365 } | 2496 } |
2366 } | 2497 } |
2367 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 2498 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
| 2499 defined(__ARM_EABI__) || \ |
2368 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || defined(__PPC__) | 2500 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || defined(__PPC__) |
2369 #define __NR__sigaction __NR_sigaction | 2501 #define __NR__sigaction __NR_sigaction |
2370 #define __NR__sigpending __NR_sigpending | 2502 #define __NR__sigpending __NR_sigpending |
2371 #define __NR__sigprocmask __NR_sigprocmask | 2503 #define __NR__sigprocmask __NR_sigprocmask |
2372 #define __NR__sigsuspend __NR_sigsuspend | 2504 #define __NR__sigsuspend __NR_sigsuspend |
2373 #define __NR__socketcall __NR_socketcall | 2505 #define __NR__socketcall __NR_socketcall |
2374 LSS_INLINE _syscall2(int, fstat64, int, f, | 2506 LSS_INLINE _syscall2(int, fstat64, int, f, |
2375 struct kernel_stat64 *, b) | 2507 struct kernel_stat64 *, b) |
2376 LSS_INLINE _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, | 2508 LSS_INLINE _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, |
2377 loff_t *, res, uint, wh) | 2509 loff_t *, res, uint, wh) |
| 2510 #if !defined(__ARM_EABI__) |
2378 LSS_INLINE _syscall1(void*, mmap, void*, a) | 2511 LSS_INLINE _syscall1(void*, mmap, void*, a) |
| 2512 #endif |
2379 LSS_INLINE _syscall6(void*, mmap2, void*, s, | 2513 LSS_INLINE _syscall6(void*, mmap2, void*, s, |
2380 size_t, l, int, p, | 2514 size_t, l, int, p, |
2381 int, f, int, d, | 2515 int, f, int, d, |
2382 __off64_t, o) | 2516 __off64_t, o) |
2383 LSS_INLINE _syscall3(int, _sigaction, int, s, | 2517 LSS_INLINE _syscall3(int, _sigaction, int, s, |
2384 const struct kernel_old_sigaction*, a, | 2518 const struct kernel_old_sigaction*, a, |
2385 struct kernel_old_sigaction*, o) | 2519 struct kernel_old_sigaction*, o) |
2386 LSS_INLINE _syscall1(int, _sigpending, unsigned long*, s) | 2520 LSS_INLINE _syscall1(int, _sigpending, unsigned long*, s) |
2387 LSS_INLINE _syscall3(int, _sigprocmask, int, h, | 2521 LSS_INLINE _syscall3(int, _sigprocmask, int, h, |
2388 const unsigned long*, s, | 2522 const unsigned long*, s, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 | 2717 |
2584 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { | 2718 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { |
2585 LSS_SC_BODY(3, int, 1, domain, type, protocol); | 2719 LSS_SC_BODY(3, int, 1, domain, type, protocol); |
2586 } | 2720 } |
2587 | 2721 |
2588 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, | 2722 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, |
2589 int sv[2]) { | 2723 int sv[2]) { |
2590 LSS_SC_BODY(4, int, 8, d, type, protocol, sv); | 2724 LSS_SC_BODY(4, int, 8, d, type, protocol, sv); |
2591 } | 2725 } |
2592 #endif | 2726 #endif |
2593 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 2727 #if defined(__ARM_EABI__) |
| 2728 LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg, |
| 2729 int, flags); |
| 2730 LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*, |
| 2731 msg, int, flags); |
| 2732 LSS_INLINE _syscall6(ssize_t, sendto, int, s, const void*, buf, size_t, len, |
| 2733 int, falgs, const struct kernel_sockaddr*, to, |
| 2734 unsigned int, tolen); |
| 2735 LSS_INLINE _syscall2(int, shutdown, int, s, int, how); |
| 2736 LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol); |
| 2737 LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol, |
| 2738 int*, sv); |
| 2739 #endif |
| 2740 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
2594 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) | 2741 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) |
2595 #define __NR__socketcall __NR_socketcall | 2742 #define __NR__socketcall __NR_socketcall |
2596 LSS_INLINE _syscall2(int, _socketcall, int, c, | 2743 LSS_INLINE _syscall2(int, _socketcall, int, c, |
2597 va_list, a) | 2744 va_list, a) |
2598 | |
2599 LSS_INLINE int LSS_NAME(socketcall)(int op, ...) { | 2745 LSS_INLINE int LSS_NAME(socketcall)(int op, ...) { |
2600 int rc; | 2746 int rc; |
2601 va_list ap; | 2747 va_list ap; |
2602 va_start(ap, op); | 2748 va_start(ap, op); |
2603 rc = LSS_NAME(_socketcall)(op, ap); | 2749 rc = LSS_NAME(_socketcall)(op, ap); |
2604 va_end(ap); | 2750 va_end(ap); |
2605 return rc; | 2751 return rc; |
2606 } | 2752 } |
2607 | |
2608 LSS_INLINE ssize_t LSS_NAME(recvmsg)(int s,struct kernel_msghdr *msg, | 2753 LSS_INLINE ssize_t LSS_NAME(recvmsg)(int s,struct kernel_msghdr *msg, |
2609 int flags){ | 2754 int flags){ |
2610 return (ssize_t)LSS_NAME(socketcall)(17, s, msg, flags); | 2755 return (ssize_t)LSS_NAME(socketcall)(17, s, msg, flags); |
2611 } | 2756 } |
2612 | |
2613 LSS_INLINE ssize_t LSS_NAME(sendmsg)(int s, | 2757 LSS_INLINE ssize_t LSS_NAME(sendmsg)(int s, |
2614 const struct kernel_msghdr *msg, | 2758 const struct kernel_msghdr *msg, |
2615 int flags) { | 2759 int flags) { |
2616 return (ssize_t)LSS_NAME(socketcall)(16, s, msg, flags); | 2760 return (ssize_t)LSS_NAME(socketcall)(16, s, msg, flags); |
2617 } | 2761 } |
2618 | |
2619 LSS_INLINE ssize_t LSS_NAME(sendto)(int s, const void *buf, size_t len, | 2762 LSS_INLINE ssize_t LSS_NAME(sendto)(int s, const void *buf, size_t len, |
2620 int flags, | 2763 int flags, |
2621 const struct kernel_sockaddr *to, | 2764 const struct kernel_sockaddr *to, |
2622 unsigned int tolen) { | 2765 unsigned int tolen) { |
2623 return (ssize_t)LSS_NAME(socketcall)(11, s, buf, len, flags, to, tolen); | 2766 return (ssize_t)LSS_NAME(socketcall)(11, s, buf, len, flags, to, tolen); |
2624 } | 2767 } |
2625 | |
2626 LSS_INLINE int LSS_NAME(shutdown)(int s, int how) { | 2768 LSS_INLINE int LSS_NAME(shutdown)(int s, int how) { |
2627 return LSS_NAME(socketcall)(13, s, how); | 2769 return LSS_NAME(socketcall)(13, s, how); |
2628 } | 2770 } |
2629 | |
2630 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { | 2771 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { |
2631 return LSS_NAME(socketcall)(1, domain, type, protocol); | 2772 return LSS_NAME(socketcall)(1, domain, type, protocol); |
2632 } | 2773 } |
2633 | 2774 |
2634 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, | 2775 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, |
2635 int sv[2]) { | 2776 int sv[2]) { |
2636 return LSS_NAME(socketcall)(8, d, type, protocol, sv); | 2777 return LSS_NAME(socketcall)(8, d, type, protocol, sv); |
2637 } | 2778 } |
2638 #endif | 2779 #endif |
2639 #if defined(__i386__) || defined(__PPC__) | 2780 #if defined(__i386__) || defined(__PPC__) |
(...skipping 26 matching lines...) Expand all Loading... |
2666 p[0] = __v0; | 2807 p[0] = __v0; |
2667 p[1] = __v1; | 2808 p[1] = __v1; |
2668 return 0; | 2809 return 0; |
2669 } | 2810 } |
2670 } | 2811 } |
2671 #else | 2812 #else |
2672 LSS_INLINE _syscall1(int, pipe, int *, p) | 2813 LSS_INLINE _syscall1(int, pipe, int *, p) |
2673 #endif | 2814 #endif |
2674 /* TODO(csilvers): see if ppc can/should support this as well */ | 2815 /* TODO(csilvers): see if ppc can/should support this as well */ |
2675 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 2816 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
| 2817 defined(__ARM_EABI__) || \ |
2676 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) | 2818 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) |
2677 #define __NR__statfs64 __NR_statfs64 | 2819 #define __NR__statfs64 __NR_statfs64 |
2678 #define __NR__fstatfs64 __NR_fstatfs64 | 2820 #define __NR__fstatfs64 __NR_fstatfs64 |
2679 LSS_INLINE _syscall3(int, _statfs64, const char*, p, | 2821 LSS_INLINE _syscall3(int, _statfs64, const char*, p, |
2680 size_t, s,struct kernel_statfs64*, b) | 2822 size_t, s,struct kernel_statfs64*, b) |
2681 LSS_INLINE _syscall3(int, _fstatfs64, int, f, | 2823 LSS_INLINE _syscall3(int, _fstatfs64, int, f, |
2682 size_t, s,struct kernel_statfs64*, b) | 2824 size_t, s,struct kernel_statfs64*, b) |
2683 LSS_INLINE int LSS_NAME(statfs64)(const char *p, | 2825 LSS_INLINE int LSS_NAME(statfs64)(const char *p, |
2684 struct kernel_statfs64 *b) { | 2826 struct kernel_statfs64 *b) { |
2685 return LSS_NAME(_statfs64)(p, sizeof(*b), b); | 2827 return LSS_NAME(_statfs64)(p, sizeof(*b), b); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2736 | 2878 |
2737 LSS_INLINE int LSS_NAME(setpgrp)() { | 2879 LSS_INLINE int LSS_NAME(setpgrp)() { |
2738 return LSS_NAME(setpgid)(0, 0); | 2880 return LSS_NAME(setpgid)(0, 0); |
2739 } | 2881 } |
2740 | 2882 |
2741 LSS_INLINE int LSS_NAME(sysconf)(int name) { | 2883 LSS_INLINE int LSS_NAME(sysconf)(int name) { |
2742 extern int __getpagesize(void); | 2884 extern int __getpagesize(void); |
2743 switch (name) { | 2885 switch (name) { |
2744 case _SC_OPEN_MAX: { | 2886 case _SC_OPEN_MAX: { |
2745 struct kernel_rlimit limit; | 2887 struct kernel_rlimit limit; |
| 2888 #if defined(__ARM_EABI__) |
| 2889 return LSS_NAME(ugetrlimit)(RLIMIT_NOFILE, &limit) < 0 |
| 2890 ? 8192 : limit.rlim_cur; |
| 2891 #else |
2746 return LSS_NAME(getrlimit)(RLIMIT_NOFILE, &limit) < 0 | 2892 return LSS_NAME(getrlimit)(RLIMIT_NOFILE, &limit) < 0 |
2747 ? 8192 : limit.rlim_cur; | 2893 ? 8192 : limit.rlim_cur; |
| 2894 #endif |
2748 } | 2895 } |
2749 case _SC_PAGESIZE: | 2896 case _SC_PAGESIZE: |
2750 return __getpagesize(); | 2897 return __getpagesize(); |
2751 default: | 2898 default: |
2752 errno = ENOSYS; | 2899 errno = ENOSYS; |
2753 return -1; | 2900 return -1; |
2754 } | 2901 } |
2755 } | 2902 } |
2756 #if defined(__x86_64__) || \ | 2903 #if defined(__x86_64__) || \ |
2757 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64) | 2904 (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 } | 2938 } |
2792 #endif | 2939 #endif |
2793 #endif | 2940 #endif |
2794 | 2941 |
2795 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 2942 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
2796 } | 2943 } |
2797 #endif | 2944 #endif |
2798 | 2945 |
2799 #endif | 2946 #endif |
2800 #endif | 2947 #endif |
OLD | NEW |