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 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2708 void *addr, PRSize len, PRIntn prot, PRIntn flags, | 2708 void *addr, PRSize len, PRIntn prot, PRIntn flags, |
2709 PRIntn fildes, PRInt64 offset) | 2709 PRIntn fildes, PRInt64 offset) |
2710 { | 2710 { |
2711 PR_SetError(PR_FILE_TOO_BIG_ERROR, 0); | 2711 PR_SetError(PR_FILE_TOO_BIG_ERROR, 0); |
2712 return NULL; | 2712 return NULL; |
2713 } /* _MD_Unix_mmap64 */ | 2713 } /* _MD_Unix_mmap64 */ |
2714 #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */ | 2714 #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */ |
2715 | 2715 |
2716 /* Android <= 19 doesn't have mmap64. */ | 2716 /* Android <= 19 doesn't have mmap64. */ |
2717 #if defined(ANDROID) && __ANDROID_API__ <= 19 | 2717 #if defined(ANDROID) && __ANDROID_API__ <= 19 |
2718 extern void *__mmap2(void *, size_t, int, int, int, size_t); | 2718 PR_IMPORT(void) *__mmap2(void *, size_t, int, int, int, size_t); |
2719 | 2719 |
2720 #define ANDROID_PAGE_SIZE 4096 | 2720 #define ANDROID_PAGE_SIZE 4096 |
2721 | 2721 |
2722 static void * | 2722 static void * |
2723 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) |
2724 { | 2724 { |
2725 if (offset & (ANDROID_PAGE_SIZE - 1)) { | 2725 if (offset & (ANDROID_PAGE_SIZE - 1)) { |
2726 errno = EINVAL; | 2726 errno = EINVAL; |
2727 return MAP_FAILED; | 2727 return MAP_FAILED; |
2728 } | 2728 } |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3033 ticks += (PRUint32)time.tv_usec / PR_USEC_PER_MSEC; /* so's that */ | 3033 ticks += (PRUint32)time.tv_usec / PR_USEC_PER_MSEC; /* so's that */ |
3034 return ticks; | 3034 return ticks; |
3035 } /* _PR_UNIX_GetInterval */ | 3035 } /* _PR_UNIX_GetInterval */ |
3036 | 3036 |
3037 PRIntervalTime _PR_UNIX_TicksPerSecond() | 3037 PRIntervalTime _PR_UNIX_TicksPerSecond() |
3038 { | 3038 { |
3039 return 1000; /* this needs some work :) */ | 3039 return 1000; /* this needs some work :) */ |
3040 } | 3040 } |
3041 #endif | 3041 #endif |
3042 | 3042 |
3043 #if defined(HAVE_CLOCK_MONOTONIC) | 3043 #if defined(_PR_HAVE_CLOCK_MONOTONIC) |
3044 PRIntervalTime _PR_UNIX_GetInterval2() | 3044 PRIntervalTime _PR_UNIX_GetInterval2() |
3045 { | 3045 { |
3046 struct timespec time; | 3046 struct timespec time; |
3047 PRIntervalTime ticks; | 3047 PRIntervalTime ticks; |
3048 | 3048 |
3049 if (clock_gettime(CLOCK_MONOTONIC, &time) != 0) { | 3049 if (clock_gettime(CLOCK_MONOTONIC, &time) != 0) { |
3050 fprintf(stderr, "clock_gettime failed: %d\n", errno); | 3050 fprintf(stderr, "clock_gettime failed: %d\n", errno); |
3051 abort(); | 3051 abort(); |
3052 } | 3052 } |
3053 | 3053 |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 rv++; | 3778 rv++; |
3779 } | 3779 } |
3780 } | 3780 } |
3781 PR_ASSERT(rv > 0); | 3781 PR_ASSERT(rv > 0); |
3782 } | 3782 } |
3783 PR_ASSERT(-1 != timeout || rv != 0); | 3783 PR_ASSERT(-1 != timeout || rv != 0); |
3784 | 3784 |
3785 return rv; | 3785 return rv; |
3786 } | 3786 } |
3787 #endif /* _PR_NEED_FAKE_POLL */ | 3787 #endif /* _PR_NEED_FAKE_POLL */ |
OLD | NEW |