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

Unified Diff: runtime/bin/fdutils_macos.cc

Issue 10357003: Beginnings of a debugger wire protocol (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/fdutils_linux.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/fdutils_macos.cc
===================================================================
--- runtime/bin/fdutils_macos.cc (revision 7329)
+++ runtime/bin/fdutils_macos.cc (working copy)
@@ -10,14 +10,14 @@
#include "bin/fdutils.h"
-bool FDUtils::SetNonBlocking(intptr_t fd) {
+static bool SetBlockingHelper(intptr_t fd, bool blocking) {
intptr_t status;
status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFL));
if (status < 0) {
perror("fcntl F_GETFL failed");
return false;
}
- status = (status | O_NONBLOCK);
+ status = blocking ? (status & ~O_NONBLOCK) : (status | O_NONBLOCK);
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFL, status)) < 0) {
perror("fcntl F_SETFL failed");
return false;
@@ -26,6 +26,16 @@
}
+bool FDUtils::SetNonBlocking(intptr_t fd) {
+ return SetBlockingHelper(fd, false);
+}
+
+
+bool FDUtils::SetBlocking(intptr_t fd) {
+ return SetBlockingHelper(fd, true);
+}
+
+
bool FDUtils::IsBlocking(intptr_t fd, bool* is_blocking) {
intptr_t status;
status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFL));
« no previous file with comments | « runtime/bin/fdutils_linux.cc ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698