| 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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 const char* File::StringEscapedPathSeparator() { | 310 const char* File::StringEscapedPathSeparator() { |
| 311 return "/"; | 311 return "/"; |
| 312 } | 312 } |
| 313 | 313 |
| 314 | 314 |
| 315 File::StdioHandleType File::GetStdioHandleType(int fd) { | 315 File::StdioHandleType File::GetStdioHandleType(int fd) { |
| 316 ASSERT(0 <= fd && fd <= 2); | 316 ASSERT(0 <= fd && fd <= 2); |
| 317 struct stat buf; | 317 struct stat buf; |
| 318 int result = fstat(fd, &buf); | 318 int result = fstat(fd, &buf); |
| 319 if (result == -1) { | 319 if (result == -1) { |
| 320 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); | 320 const int kBufferSize = 1024; |
| 321 char error_message[kBufferSize]; |
| 322 strerror_r(errno, error_message, kBufferSize); |
| 323 FATAL2("Failed stat on file descriptor %d: %s", fd, error_message); |
| 321 } | 324 } |
| 322 if (S_ISCHR(buf.st_mode)) return kTerminal; | 325 if (S_ISCHR(buf.st_mode)) return kTerminal; |
| 323 if (S_ISFIFO(buf.st_mode)) return kPipe; | 326 if (S_ISFIFO(buf.st_mode)) return kPipe; |
| 324 if (S_ISSOCK(buf.st_mode)) return kSocket; | 327 if (S_ISSOCK(buf.st_mode)) return kSocket; |
| 325 if (S_ISREG(buf.st_mode)) return kFile; | 328 if (S_ISREG(buf.st_mode)) return kFile; |
| 326 return kOther; | 329 return kOther; |
| 327 } | 330 } |
| 328 | 331 |
| 329 | 332 |
| 330 File::Type File::GetType(const char* pathname, bool follow_links) { | 333 File::Type File::GetType(const char* pathname, bool follow_links) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 353 return (file_1_info.st_ino == file_2_info.st_ino && | 356 return (file_1_info.st_ino == file_2_info.st_ino && |
| 354 file_1_info.st_dev == file_2_info.st_dev) ? | 357 file_1_info.st_dev == file_2_info.st_dev) ? |
| 355 File::kIdentical : | 358 File::kIdentical : |
| 356 File::kDifferent; | 359 File::kDifferent; |
| 357 } | 360 } |
| 358 | 361 |
| 359 } // namespace bin | 362 } // namespace bin |
| 360 } // namespace dart | 363 } // namespace dart |
| 361 | 364 |
| 362 #endif // defined(TARGET_OS_ANDROID) | 365 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |