| 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_MACOS) | 6 #if defined(HOST_OS_MACOS) |
| 7 | 7 |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include <copyfile.h> // NOLINT | 10 #include <copyfile.h> // NOLINT |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 const char* File::StringEscapedPathSeparator() { | 533 const char* File::StringEscapedPathSeparator() { |
| 534 return "/"; | 534 return "/"; |
| 535 } | 535 } |
| 536 | 536 |
| 537 | 537 |
| 538 File::StdioHandleType File::GetStdioHandleType(int fd) { | 538 File::StdioHandleType File::GetStdioHandleType(int fd) { |
| 539 ASSERT((0 <= fd) && (fd <= 2)); | 539 ASSERT((0 <= fd) && (fd <= 2)); |
| 540 struct stat buf; | 540 struct stat buf; |
| 541 int result = fstat(fd, &buf); | 541 int result = fstat(fd, &buf); |
| 542 if (result == -1) { | 542 if (result == -1) { |
| 543 const int kBufferSize = 1024; | 543 return kOther; |
| 544 char error_message[kBufferSize]; | |
| 545 Utils::StrError(errno, error_message, kBufferSize); | |
| 546 FATAL2("Failed stat on file descriptor %d: %s", fd, error_message); | |
| 547 } | 544 } |
| 548 if (S_ISCHR(buf.st_mode)) { | 545 if (S_ISCHR(buf.st_mode)) { |
| 549 return kTerminal; | 546 return kTerminal; |
| 550 } | 547 } |
| 551 if (S_ISFIFO(buf.st_mode)) { | 548 if (S_ISFIFO(buf.st_mode)) { |
| 552 return kPipe; | 549 return kPipe; |
| 553 } | 550 } |
| 554 if (S_ISSOCK(buf.st_mode)) { | 551 if (S_ISSOCK(buf.st_mode)) { |
| 555 return kSocket; | 552 return kSocket; |
| 556 } | 553 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 571 return ((file_1_info.st_ino == file_2_info.st_ino) && | 568 return ((file_1_info.st_ino == file_2_info.st_ino) && |
| 572 (file_1_info.st_dev == file_2_info.st_dev)) | 569 (file_1_info.st_dev == file_2_info.st_dev)) |
| 573 ? File::kIdentical | 570 ? File::kIdentical |
| 574 : File::kDifferent; | 571 : File::kDifferent; |
| 575 } | 572 } |
| 576 | 573 |
| 577 } // namespace bin | 574 } // namespace bin |
| 578 } // namespace dart | 575 } // namespace dart |
| 579 | 576 |
| 580 #endif // defined(HOST_OS_MACOS) | 577 #endif // defined(HOST_OS_MACOS) |
| OLD | NEW |