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

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

Issue 2563463002: Fuchsia: dart:io Processes (Closed)
Patch Set: Format Created 4 years 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/BUILD.gn ('k') | runtime/bin/process_fuchsia.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(TARGET_OS_FUCHSIA) 6 #if defined(TARGET_OS_FUCHSIA)
7 7
8 #include "bin/fdutils.h" 8 #include "bin/fdutils.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 *is_blocking = (status & O_NONBLOCK) == 0; 68 *is_blocking = (status & O_NONBLOCK) == 0;
69 return true; 69 return true;
70 } 70 }
71 71
72 72
73 intptr_t FDUtils::AvailableBytes(intptr_t fd) { 73 intptr_t FDUtils::AvailableBytes(intptr_t fd) {
74 int available; // ioctl for FIONREAD expects an 'int*' argument. 74 int available; // ioctl for FIONREAD expects an 'int*' argument.
75 int result = NO_RETRY_EXPECTED(ioctl(fd, FIONREAD, &available)); 75 int result = NO_RETRY_EXPECTED(ioctl(fd, FIONREAD, &available));
76 if (result < 0) { 76 if (result < 0) {
77 perror("ioctl(fd, FIONREAD, &available) failed");
77 return result; 78 return result;
78 } 79 }
79 ASSERT(available >= 0); 80 ASSERT(available >= 0);
80 return static_cast<intptr_t>(available); 81 return static_cast<intptr_t>(available);
81 } 82 }
82 83
83 84
84 ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) { 85 ssize_t FDUtils::ReadFromBlocking(int fd, void* buffer, size_t count) {
85 #ifdef DEBUG 86 #ifdef DEBUG
86 bool is_blocking = false; 87 bool is_blocking = false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void FDUtils::SaveErrorAndClose(intptr_t fd) { 141 void FDUtils::SaveErrorAndClose(intptr_t fd) {
141 int err = errno; 142 int err = errno;
142 NO_RETRY_EXPECTED(close(fd)); 143 NO_RETRY_EXPECTED(close(fd));
143 errno = err; 144 errno = err;
144 } 145 }
145 146
146 } // namespace bin 147 } // namespace bin
147 } // namespace dart 148 } // namespace dart
148 149
149 #endif // defined(TARGET_OS_FUCHSIA) 150 #endif // defined(TARGET_OS_FUCHSIA)
OLDNEW
« no previous file with comments | « runtime/bin/BUILD.gn ('k') | runtime/bin/process_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698