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> |
11 #include <fcntl.h> | 11 #include <fcntl.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 #include <sys/socket.h> | 13 #include <sys/socket.h> |
14 #include <sys/time.h> | 14 #include <sys/time.h> |
15 #include <sys/ioctl.h> | 15 #include <sys/ioctl.h> |
16 #include <sys/mman.h> | 16 #include <sys/mman.h> |
17 #include <unistd.h> | 17 #include <unistd.h> |
18 #include <sys/utsname.h> | 18 #include <sys/utsname.h> |
19 | 19 |
20 #ifdef _PR_POLL_AVAILABLE | 20 #ifdef _PR_POLL_AVAILABLE |
21 #include <poll.h> | 21 #include <poll.h> |
22 #endif | 22 #endif |
23 | 23 |
| 24 #if defined(ANDROID) |
| 25 #include <android/api-level.h> |
| 26 #endif |
| 27 |
24 /* To get FIONREAD */ | 28 /* To get FIONREAD */ |
25 #if defined(UNIXWARE) | 29 #if defined(UNIXWARE) |
26 #include <sys/filio.h> | 30 #include <sys/filio.h> |
27 #endif | 31 #endif |
28 | 32 |
29 #if defined(NTO) | 33 #if defined(NTO) |
30 #include <sys/statvfs.h> | 34 #include <sys/statvfs.h> |
31 #endif | 35 #endif |
32 | 36 |
33 /* | 37 /* |
(...skipping 2668 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. */ | 2716 /* Android <= 19 doesn't have mmap64. */ |
2713 #if defined(ANDROID) | 2717 #if defined(ANDROID) && __ANDROID_API__ <= 19 |
2714 extern void *__mmap2(void *, size_t, int, int, int, size_t); | 2718 extern void *__mmap2(void *, size_t, int, int, int, size_t); |
2715 | 2719 |
2716 #define ANDROID_PAGE_SIZE 4096 | 2720 #define ANDROID_PAGE_SIZE 4096 |
2717 | 2721 |
2718 static void * | 2722 static void * |
2719 mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset) | 2723 mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset) |
2720 { | 2724 { |
2721 if (offset & (ANDROID_PAGE_SIZE - 1)) { | 2725 if (offset & (ANDROID_PAGE_SIZE - 1)) { |
2722 errno = EINVAL; | 2726 errno = EINVAL; |
2723 return MAP_FAILED; | 2727 return MAP_FAILED; |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3774 rv++; | 3778 rv++; |
3775 } | 3779 } |
3776 } | 3780 } |
3777 PR_ASSERT(rv > 0); | 3781 PR_ASSERT(rv > 0); |
3778 } | 3782 } |
3779 PR_ASSERT(-1 != timeout || rv != 0); | 3783 PR_ASSERT(-1 != timeout || rv != 0); |
3780 | 3784 |
3781 return rv; | 3785 return rv; |
3782 } | 3786 } |
3783 #endif /* _PR_NEED_FAKE_POLL */ | 3787 #endif /* _PR_NEED_FAKE_POLL */ |
OLD | NEW |