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 | 16 |
16 | 17 |
17 namespace dart { | 18 namespace dart { |
18 namespace bin { | 19 namespace bin { |
19 | 20 |
20 OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { | 21 OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { |
21 set_sub_system(kSystem); | 22 set_sub_system(kSystem); |
22 set_code(errno); | 23 set_code(errno); |
23 const int kBufferSize = 1024; | 24 const int kBufferSize = 1024; |
24 char error_buf[kBufferSize]; | 25 char error_buf[kBufferSize]; |
25 SetMessage(strerror_r(errno, error_buf, kBufferSize)); | 26 SetMessage(Utils::StrError(errno, error_buf, kBufferSize)); |
26 } | 27 } |
27 | 28 |
28 | 29 |
29 void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { | 30 void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { |
30 set_sub_system(sub_system); | 31 set_sub_system(sub_system); |
31 set_code(code); | 32 set_code(code); |
32 if (sub_system == kSystem) { | 33 if (sub_system == kSystem) { |
33 const int kBufferSize = 1024; | 34 const int kBufferSize = 1024; |
34 char error_buf[kBufferSize]; | 35 char error_buf[kBufferSize]; |
35 SetMessage(strerror_r(code, error_buf, kBufferSize)); | 36 SetMessage(Utils::StrError(code, error_buf, kBufferSize)); |
36 } else if (sub_system == kGetAddressInfo) { | 37 } else if (sub_system == kGetAddressInfo) { |
37 SetMessage(gai_strerror(code)); | 38 SetMessage(gai_strerror(code)); |
38 } else { | 39 } else { |
39 UNREACHABLE(); | 40 UNREACHABLE(); |
40 } | 41 } |
41 } | 42 } |
42 | 43 |
43 const char* StringUtils::ConsoleStringToUtf8( | 44 const char* StringUtils::ConsoleStringToUtf8( |
44 const char* str, intptr_t len, intptr_t* result_len) { | 45 const char* str, intptr_t len, intptr_t* result_len) { |
45 UNIMPLEMENTED(); | 46 UNIMPLEMENTED(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 ASSERT(errno == EINTR); | 100 ASSERT(errno == EINTR); |
100 // Copy remainder into requested and repeat. | 101 // Copy remainder into requested and repeat. |
101 req = rem; | 102 req = rem; |
102 } | 103 } |
103 } | 104 } |
104 | 105 |
105 } // namespace bin | 106 } // namespace bin |
106 } // namespace dart | 107 } // namespace dart |
107 | 108 |
108 #endif // defined(TARGET_OS_LINUX) | 109 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |