OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
11 #include <limits.h> // NOLINT | 11 #include <limits.h> // NOLINT |
12 #include <mach/mach.h> // NOLINT | 12 #include <mach/mach.h> // NOLINT |
13 #include <mach/clock.h> // NOLINT | 13 #include <mach/clock.h> // NOLINT |
14 #include <mach/mach_time.h> // NOLINT | 14 #include <mach/mach_time.h> // NOLINT |
15 #include <sys/time.h> // NOLINT | 15 #include <sys/time.h> // NOLINT |
16 #include <sys/resource.h> // NOLINT | 16 #include <sys/resource.h> // NOLINT |
17 #include <unistd.h> // NOLINT | 17 #include <unistd.h> // NOLINT |
18 | 18 |
19 #include "platform/utils.h" | 19 #include "platform/utils.h" |
20 #include "vm/isolate.h" | 20 #include "vm/isolate.h" |
21 | 21 |
22 namespace dart { | 22 namespace dart { |
23 | 23 |
24 const char* OS::Name() { | 24 const char* OS::Name() { |
25 return "macos"; | 25 return "macos"; |
26 } | 26 } |
27 | 27 |
28 | 28 |
| 29 intptr_t OS::ProcessId() { |
| 30 return static_cast<intptr_t>(getpid()); |
| 31 } |
| 32 |
| 33 |
29 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { | 34 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { |
30 time_t seconds = static_cast<time_t>(seconds_since_epoch); | 35 time_t seconds = static_cast<time_t>(seconds_since_epoch); |
31 if (seconds != seconds_since_epoch) return false; | 36 if (seconds != seconds_since_epoch) return false; |
32 struct tm* error_code = localtime_r(&seconds, tm_result); | 37 struct tm* error_code = localtime_r(&seconds, tm_result); |
33 return error_code != NULL; | 38 return error_code != NULL; |
34 } | 39 } |
35 | 40 |
36 | 41 |
37 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { | 42 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { |
38 tm decomposed; | 43 tm decomposed; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 251 } |
247 | 252 |
248 | 253 |
249 void OS::Exit(int code) { | 254 void OS::Exit(int code) { |
250 exit(code); | 255 exit(code); |
251 } | 256 } |
252 | 257 |
253 } // namespace dart | 258 } // namespace dart |
254 | 259 |
255 #endif // defined(TARGET_OS_MACOS) | 260 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |