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

Side by Side Diff: runtime/bin/file_linux.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_fuchsia.cc ('k') | runtime/bin/file_macos.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) 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_LINUX) 6 #if defined(HOST_OS_LINUX)
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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 const char* File::StringEscapedPathSeparator() { 571 const char* File::StringEscapedPathSeparator() {
572 return "/"; 572 return "/";
573 } 573 }
574 574
575 575
576 File::StdioHandleType File::GetStdioHandleType(int fd) { 576 File::StdioHandleType File::GetStdioHandleType(int fd) {
577 ASSERT((0 <= fd) && (fd <= 2)); 577 ASSERT((0 <= fd) && (fd <= 2));
578 struct stat64 buf; 578 struct stat64 buf;
579 int result = TEMP_FAILURE_RETRY(fstat64(fd, &buf)); 579 int result = TEMP_FAILURE_RETRY(fstat64(fd, &buf));
580 if (result == -1) { 580 if (result == -1) {
581 const int kBufferSize = 1024; 581 return kOther;
582 char error_buf[kBufferSize];
583 FATAL2("Failed stat on file descriptor %d: %s", fd,
584 Utils::StrError(errno, error_buf, kBufferSize));
585 } 582 }
586 if (S_ISCHR(buf.st_mode)) { 583 if (S_ISCHR(buf.st_mode)) {
587 return kTerminal; 584 return kTerminal;
588 } 585 }
589 if (S_ISFIFO(buf.st_mode)) { 586 if (S_ISFIFO(buf.st_mode)) {
590 return kPipe; 587 return kPipe;
591 } 588 }
592 if (S_ISSOCK(buf.st_mode)) { 589 if (S_ISSOCK(buf.st_mode)) {
593 return kSocket; 590 return kSocket;
594 } 591 }
(...skipping 14 matching lines...) Expand all
609 return ((file_1_info.st_ino == file_2_info.st_ino) && 606 return ((file_1_info.st_ino == file_2_info.st_ino) &&
610 (file_1_info.st_dev == file_2_info.st_dev)) 607 (file_1_info.st_dev == file_2_info.st_dev))
611 ? File::kIdentical 608 ? File::kIdentical
612 : File::kDifferent; 609 : File::kDifferent;
613 } 610 }
614 611
615 } // namespace bin 612 } // namespace bin
616 } // namespace dart 613 } // namespace dart
617 614
618 #endif // defined(HOST_OS_LINUX) 615 #endif // defined(HOST_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/file_fuchsia.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698