Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: runtime/bin/utils_macos.cc

Issue 1466523002: Landing patch set 7 from https://codereview.chromium.org/1450113003/ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/utils_linux.cc ('k') | runtime/platform/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MACOS) 6 #if defined(TARGET_OS_MACOS)
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_message[kBufferSize]; 25 char error_message[kBufferSize];
25 strerror_r(errno, error_message, kBufferSize); 26 Utils::StrError(errno, error_message, kBufferSize);
26 SetMessage(error_message); 27 SetMessage(error_message);
27 } 28 }
28 29
29 30
30 void OSError::SetCodeAndMessage(SubSystem sub_system, int code) { 31 void OSError::SetCodeAndMessage(SubSystem sub_system, int code) {
31 set_sub_system(sub_system); 32 set_sub_system(sub_system);
32 set_code(code); 33 set_code(code);
33 if (sub_system == kSystem) { 34 if (sub_system == kSystem) {
34 const int kBufferSize = 1024; 35 const int kBufferSize = 1024;
35 char error_message[kBufferSize]; 36 char error_message[kBufferSize];
36 strerror_r(code, error_message, kBufferSize); 37 Utils::StrError(code, error_message, kBufferSize);
37 SetMessage(error_message); 38 SetMessage(error_message);
38 } else if (sub_system == kGetAddressInfo) { 39 } else if (sub_system == kGetAddressInfo) {
39 SetMessage(gai_strerror(code)); 40 SetMessage(gai_strerror(code));
40 } else { 41 } else {
41 UNREACHABLE(); 42 UNREACHABLE();
42 } 43 }
43 } 44 }
44 45
45 const char* StringUtils::ConsoleStringToUtf8( 46 const char* StringUtils::ConsoleStringToUtf8(
46 const char* str, intptr_t len, intptr_t* result_len) { 47 const char* str, intptr_t len, intptr_t* result_len) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ASSERT(errno == EINTR); 102 ASSERT(errno == EINTR);
102 // Copy remainder into requested and repeat. 103 // Copy remainder into requested and repeat.
103 req = rem; 104 req = rem;
104 } 105 }
105 } 106 }
106 107
107 } // namespace bin 108 } // namespace bin
108 } // namespace dart 109 } // namespace dart
109 110
110 #endif // defined(TARGET_OS_MACOS) 111 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/utils_linux.cc ('k') | runtime/platform/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698