Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | 5 |
| 6 #include "primpl.h" | 6 #include "primpl.h" |
| 7 | 7 |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <signal.h> | 9 #include <signal.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 /* To get FIONREAD */ | 24 /* To get FIONREAD */ |
| 25 #if defined(UNIXWARE) | 25 #if defined(UNIXWARE) |
| 26 #include <sys/filio.h> | 26 #include <sys/filio.h> |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 #if defined(NTO) | 29 #if defined(NTO) |
| 30 #include <sys/statvfs.h> | 30 #include <sys/statvfs.h> |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 #if defined(ANDROID) | |
| 34 #include <android/api-level.h> | |
| 35 #endif | |
| 36 | |
| 33 /* | 37 /* |
| 34 * Make sure _PRSockLen_t is 32-bit, because we will cast a PRUint32* or | 38 * Make sure _PRSockLen_t is 32-bit, because we will cast a PRUint32* or |
| 35 * PRInt32* pointer to a _PRSockLen_t* pointer. | 39 * PRInt32* pointer to a _PRSockLen_t* pointer. |
| 36 */ | 40 */ |
| 37 #if defined(HAVE_SOCKLEN_T) \ | 41 #if defined(HAVE_SOCKLEN_T) \ |
| 38 || (defined(__GLIBC__) && __GLIBC__ >= 2) | 42 || (defined(__GLIBC__) && __GLIBC__ >= 2) |
| 39 #define _PRSockLen_t socklen_t | 43 #define _PRSockLen_t socklen_t |
| 40 #elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \ | 44 #elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \ |
| 41 || defined(AIX4_1) || defined(LINUX) \ | 45 || defined(AIX4_1) || defined(LINUX) \ |
| 42 || defined(BSDI) || defined(SCO) \ | 46 || defined(BSDI) || defined(SCO) \ |
| (...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2702 | 2706 |
| 2703 static void* _MD_Unix_mmap64( | 2707 static void* _MD_Unix_mmap64( |
| 2704 void *addr, PRSize len, PRIntn prot, PRIntn flags, | 2708 void *addr, PRSize len, PRIntn prot, PRIntn flags, |
| 2705 PRIntn fildes, PRInt64 offset) | 2709 PRIntn fildes, PRInt64 offset) |
| 2706 { | 2710 { |
| 2707 PR_SetError(PR_FILE_TOO_BIG_ERROR, 0); | 2711 PR_SetError(PR_FILE_TOO_BIG_ERROR, 0); |
| 2708 return NULL; | 2712 return NULL; |
| 2709 } /* _MD_Unix_mmap64 */ | 2713 } /* _MD_Unix_mmap64 */ |
| 2710 #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */ | 2714 #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */ |
| 2711 | 2715 |
| 2712 /* Android doesn't have mmap64. */ | |
| 2713 #if defined(ANDROID) | 2716 #if defined(ANDROID) |
| 2717 /* Android <= 19 doesn't have mmap64. */ | |
| 2718 #if __ANDROID_API__ <= 19 | |
| 2714 extern void *__mmap2(void *, size_t, int, int, int, size_t); | 2719 extern void *__mmap2(void *, size_t, int, int, int, size_t); |
| 2715 | 2720 |
| 2716 #define ANDROID_PAGE_SIZE 4096 | 2721 #define ANDROID_PAGE_SIZE 4096 |
| 2717 | 2722 |
| 2718 static void * | 2723 static void * |
| 2719 mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset) | 2724 mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset) |
| 2720 { | 2725 { |
| 2721 if (offset & (ANDROID_PAGE_SIZE - 1)) { | 2726 if (offset & (ANDROID_PAGE_SIZE - 1)) { |
| 2722 errno = EINVAL; | 2727 errno = EINVAL; |
| 2723 return MAP_FAILED; | 2728 return MAP_FAILED; |
| 2724 } | 2729 } |
| 2725 return __mmap2(addr, len, prot, flags, fd, offset / ANDROID_PAGE_SIZE); | 2730 return __mmap2(addr, len, prot, flags, fd, offset / ANDROID_PAGE_SIZE); |
| 2726 } | 2731 } |
| 2727 #endif | 2732 #endif // __ANDROID_API__ <= 19 |
| 2733 #endif // defined(ANDROID) | |
|
wtc
2014/07/22 23:45:12
Nit: use pre-C99 /* */ comment delimiters in this
| |
| 2728 | 2734 |
| 2729 #if defined(OSF1) && defined(__GNUC__) | 2735 #if defined(OSF1) && defined(__GNUC__) |
| 2730 | 2736 |
| 2731 /* | 2737 /* |
| 2732 * On OSF1 V5.0A, <sys/stat.h> defines stat and fstat as | 2738 * On OSF1 V5.0A, <sys/stat.h> defines stat and fstat as |
| 2733 * macros when compiled under gcc, so it is rather tricky to | 2739 * macros when compiled under gcc, so it is rather tricky to |
| 2734 * take the addresses of the real functions the macros expend | 2740 * take the addresses of the real functions the macros expend |
| 2735 * to. A simple solution is to define forwarder functions | 2741 * to. A simple solution is to define forwarder functions |
| 2736 * and take the addresses of the forwarder functions instead. | 2742 * and take the addresses of the forwarder functions instead. |
| 2737 */ | 2743 */ |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3774 rv++; | 3780 rv++; |
| 3775 } | 3781 } |
| 3776 } | 3782 } |
| 3777 PR_ASSERT(rv > 0); | 3783 PR_ASSERT(rv > 0); |
| 3778 } | 3784 } |
| 3779 PR_ASSERT(-1 != timeout || rv != 0); | 3785 PR_ASSERT(-1 != timeout || rv != 0); |
| 3780 | 3786 |
| 3781 return rv; | 3787 return rv; |
| 3782 } | 3788 } |
| 3783 #endif /* _PR_NEED_FAKE_POLL */ | 3789 #endif /* _PR_NEED_FAKE_POLL */ |
| OLD | NEW |