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 "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
7 | 7 |
8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
9 #include <netdb.h> // NOLINT | 9 #include <netdb.h> // NOLINT |
10 #include <sys/time.h> // NOLINT | 10 #include <sys/time.h> // NOLINT |
11 #include <time.h> // NOLINT | 11 #include <time.h> // NOLINT |
12 | 12 |
13 #include "bin/utils.h" | 13 #include "bin/utils.h" |
14 #include "platform/assert.h" | 14 #include "platform/assert.h" |
15 #include "platform/utils.h" | 15 #include "platform/utils.h" |
16 | 16 |
17 namespace dart { | 17 namespace dart { |
18 namespace bin { | 18 namespace bin { |
19 | 19 |
20 OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { | 20 OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { |
21 set_sub_system(kSystem); | 21 set_sub_system(kSystem); |
(...skipping 12 matching lines...) Expand all Loading... |
34 char error_buf[kBufferSize]; | 34 char error_buf[kBufferSize]; |
35 SetMessage(Utils::StrError(code, error_buf, kBufferSize)); | 35 SetMessage(Utils::StrError(code, error_buf, kBufferSize)); |
36 } else if (sub_system == kGetAddressInfo) { | 36 } else if (sub_system == kGetAddressInfo) { |
37 SetMessage(gai_strerror(code)); | 37 SetMessage(gai_strerror(code)); |
38 } else { | 38 } else { |
39 UNREACHABLE(); | 39 UNREACHABLE(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 const char* StringUtils::ConsoleStringToUtf8( | 44 const char* StringUtils::ConsoleStringToUtf8(const char* str, |
45 const char* str, intptr_t len, intptr_t* result_len) { | 45 intptr_t len, |
| 46 intptr_t* result_len) { |
46 UNIMPLEMENTED(); | 47 UNIMPLEMENTED(); |
47 return NULL; | 48 return NULL; |
48 } | 49 } |
49 | 50 |
50 | 51 |
51 const char* StringUtils::Utf8ToConsoleString( | 52 const char* StringUtils::Utf8ToConsoleString(const char* utf8, |
52 const char* utf8, intptr_t len, intptr_t* result_len) { | 53 intptr_t len, |
| 54 intptr_t* result_len) { |
53 UNIMPLEMENTED(); | 55 UNIMPLEMENTED(); |
54 return NULL; | 56 return NULL; |
55 } | 57 } |
56 | 58 |
57 | 59 |
58 char* StringUtils::ConsoleStringToUtf8( | 60 char* StringUtils::ConsoleStringToUtf8(char* str, |
59 char* str, intptr_t len, intptr_t* result_len) { | 61 intptr_t len, |
| 62 intptr_t* result_len) { |
60 UNIMPLEMENTED(); | 63 UNIMPLEMENTED(); |
61 return NULL; | 64 return NULL; |
62 } | 65 } |
63 | 66 |
64 | 67 |
65 char* StringUtils::Utf8ToConsoleString( | 68 char* StringUtils::Utf8ToConsoleString(char* utf8, |
66 char* utf8, intptr_t len, intptr_t* result_len) { | 69 intptr_t len, |
| 70 intptr_t* result_len) { |
67 UNIMPLEMENTED(); | 71 UNIMPLEMENTED(); |
68 return NULL; | 72 return NULL; |
69 } | 73 } |
70 | 74 |
71 | 75 |
72 char* StringUtils::StrNDup(const char* s, intptr_t n) { | 76 char* StringUtils::StrNDup(const char* s, intptr_t n) { |
73 return strndup(s, n); | 77 return strndup(s, n); |
74 } | 78 } |
75 | 79 |
76 | 80 |
77 bool ShellUtils::GetUtf8Argv(int argc, char** argv) { | 81 bool ShellUtils::GetUtf8Argv(int argc, char** argv) { |
78 return false; | 82 return false; |
79 } | 83 } |
80 | 84 |
81 | 85 |
82 void TimerUtils::InitOnce() { | 86 void TimerUtils::InitOnce() {} |
83 } | |
84 | 87 |
85 | 88 |
86 int64_t TimerUtils::GetCurrentMonotonicMillis() { | 89 int64_t TimerUtils::GetCurrentMonotonicMillis() { |
87 return GetCurrentMonotonicMicros() / 1000; | 90 return GetCurrentMonotonicMicros() / 1000; |
88 } | 91 } |
89 | 92 |
90 | 93 |
91 int64_t TimerUtils::GetCurrentMonotonicMicros() { | 94 int64_t TimerUtils::GetCurrentMonotonicMicros() { |
92 struct timespec ts; | 95 struct timespec ts; |
93 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { | 96 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { |
(...skipping 26 matching lines...) Expand all Loading... |
120 ASSERT(errno == EINTR); | 123 ASSERT(errno == EINTR); |
121 // Copy remainder into requested and repeat. | 124 // Copy remainder into requested and repeat. |
122 req = rem; | 125 req = rem; |
123 } | 126 } |
124 } | 127 } |
125 | 128 |
126 } // namespace bin | 129 } // namespace bin |
127 } // namespace dart | 130 } // namespace dart |
128 | 131 |
129 #endif // defined(TARGET_OS_LINUX) | 132 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |