OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Platform-specific code for FreeBSD goes here. For the POSIX-compatible | 5 // Platform-specific code for FreeBSD goes here. For the POSIX-compatible |
6 // parts, the implementation is in platform-posix.cc. | 6 // parts, the implementation is in platform-posix.cc. |
7 | 7 |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include <semaphore.h> | 9 #include <semaphore.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "src/base/platform/platform.h" | 32 #include "src/base/platform/platform.h" |
33 | 33 |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace base { | 36 namespace base { |
37 | 37 |
38 | 38 |
39 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 39 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
40 if (std::isnan(time)) return ""; | 40 if (std::isnan(time)) return ""; |
41 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 41 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
42 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) | 42 struct tm tm; |
| 43 struct tm* t = localtime_r(&tv, &tm); |
43 if (NULL == t) return ""; | 44 if (NULL == t) return ""; |
44 return t->tm_zone; | 45 return t->tm_zone; |
45 } | 46 } |
46 | 47 |
47 | 48 |
48 double OS::LocalTimeOffset(TimezoneCache* cache) { | 49 double OS::LocalTimeOffset(TimezoneCache* cache) { |
49 time_t tv = time(NULL); | 50 time_t tv = time(NULL); |
50 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) | 51 struct tm tm; |
| 52 struct tm* t = localtime_r(&tv, &tm); |
51 // tm_gmtoff includes any daylight savings offset, so subtract it. | 53 // tm_gmtoff includes any daylight savings offset, so subtract it. |
52 return static_cast<double>(t->tm_gmtoff * msPerSecond - | 54 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
53 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 55 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
54 } | 56 } |
55 | 57 |
56 | 58 |
57 void* OS::Allocate(const size_t requested, | 59 void* OS::Allocate(const size_t requested, |
58 size_t* allocated, | 60 size_t* allocated, |
59 bool executable) { | 61 bool executable) { |
60 const size_t msize = RoundUp(requested, getpagesize()); | 62 const size_t msize = RoundUp(requested, getpagesize()); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 252 } |
251 | 253 |
252 | 254 |
253 bool VirtualMemory::HasLazyCommits() { | 255 bool VirtualMemory::HasLazyCommits() { |
254 // TODO(alph): implement for the platform. | 256 // TODO(alph): implement for the platform. |
255 return false; | 257 return false; |
256 } | 258 } |
257 | 259 |
258 } // namespace base | 260 } // namespace base |
259 } // namespace v8 | 261 } // namespace v8 |
OLD | NEW |