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

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

Issue 2791423002: [dart:io] Don't close stdin with a socket finalizer (Closed)
Patch Set: Address comments Created 3 years, 8 months 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/file_android.cc ('k') | runtime/bin/file_linux.cc » ('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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_FUCHSIA) 6 #if defined(HOST_OS_FUCHSIA)
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 const char* File::StringEscapedPathSeparator() { 534 const char* File::StringEscapedPathSeparator() {
535 return "/"; 535 return "/";
536 } 536 }
537 537
538 538
539 File::StdioHandleType File::GetStdioHandleType(int fd) { 539 File::StdioHandleType File::GetStdioHandleType(int fd) {
540 ASSERT((0 <= fd) && (fd <= 2)); 540 ASSERT((0 <= fd) && (fd <= 2));
541 struct stat buf; 541 struct stat buf;
542 int result = fstat(fd, &buf); 542 int result = fstat(fd, &buf);
543 if (result == -1) { 543 if (result == -1) {
544 const int kBufferSize = 1024; 544 return kOther;
545 char error_message[kBufferSize];
546 Utils::StrError(errno, error_message, kBufferSize);
547 FATAL2("Failed stat on file descriptor %d: %s", fd, error_message);
548 } 545 }
549 if (S_ISCHR(buf.st_mode)) { 546 if (S_ISCHR(buf.st_mode)) {
550 return kTerminal; 547 return kTerminal;
551 } 548 }
552 if (S_ISFIFO(buf.st_mode)) { 549 if (S_ISFIFO(buf.st_mode)) {
553 return kPipe; 550 return kPipe;
554 } 551 }
555 if (S_ISSOCK(buf.st_mode)) { 552 if (S_ISSOCK(buf.st_mode)) {
556 return kSocket; 553 return kSocket;
557 } 554 }
(...skipping 14 matching lines...) Expand all
572 return ((file_1_info.st_ino == file_2_info.st_ino) && 569 return ((file_1_info.st_ino == file_2_info.st_ino) &&
573 (file_1_info.st_dev == file_2_info.st_dev)) 570 (file_1_info.st_dev == file_2_info.st_dev))
574 ? File::kIdentical 571 ? File::kIdentical
575 : File::kDifferent; 572 : File::kDifferent;
576 } 573 }
577 574
578 } // namespace bin 575 } // namespace bin
579 } // namespace dart 576 } // namespace dart
580 577
581 #endif // defined(HOST_OS_FUCHSIA) 578 #endif // defined(HOST_OS_FUCHSIA)
OLDNEW
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698