| 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(HOST_OS_ANDROID) | 6 #if defined(HOST_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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 const char* File::StringEscapedPathSeparator() { | 559 const char* File::StringEscapedPathSeparator() { |
| 560 return "/"; | 560 return "/"; |
| 561 } | 561 } |
| 562 | 562 |
| 563 | 563 |
| 564 File::StdioHandleType File::GetStdioHandleType(int fd) { | 564 File::StdioHandleType File::GetStdioHandleType(int fd) { |
| 565 ASSERT((0 <= fd) && (fd <= 2)); | 565 ASSERT((0 <= fd) && (fd <= 2)); |
| 566 struct stat buf; | 566 struct stat buf; |
| 567 int result = fstat(fd, &buf); | 567 int result = fstat(fd, &buf); |
| 568 if (result == -1) { | 568 if (result == -1) { |
| 569 const int kBufferSize = 1024; | 569 return kOther; |
| 570 char error_message[kBufferSize]; | |
| 571 Utils::StrError(errno, error_message, kBufferSize); | |
| 572 FATAL2("Failed stat on file descriptor %d: %s", fd, error_message); | |
| 573 } | 570 } |
| 574 if (S_ISCHR(buf.st_mode)) { | 571 if (S_ISCHR(buf.st_mode)) { |
| 575 return kTerminal; | 572 return kTerminal; |
| 576 } | 573 } |
| 577 if (S_ISFIFO(buf.st_mode)) { | 574 if (S_ISFIFO(buf.st_mode)) { |
| 578 return kPipe; | 575 return kPipe; |
| 579 } | 576 } |
| 580 if (S_ISSOCK(buf.st_mode)) { | 577 if (S_ISSOCK(buf.st_mode)) { |
| 581 return kSocket; | 578 return kSocket; |
| 582 } | 579 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 597 return ((file_1_info.st_ino == file_2_info.st_ino) && | 594 return ((file_1_info.st_ino == file_2_info.st_ino) && |
| 598 (file_1_info.st_dev == file_2_info.st_dev)) | 595 (file_1_info.st_dev == file_2_info.st_dev)) |
| 599 ? File::kIdentical | 596 ? File::kIdentical |
| 600 : File::kDifferent; | 597 : File::kDifferent; |
| 601 } | 598 } |
| 602 | 599 |
| 603 } // namespace bin | 600 } // namespace bin |
| 604 } // namespace dart | 601 } // namespace dart |
| 605 | 602 |
| 606 #endif // defined(HOST_OS_ANDROID) | 603 #endif // defined(HOST_OS_ANDROID) |
| OLD | NEW |