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

Unified Diff: runtime/bin/platform_linux.cc

Issue 8662006: Fix a number of issues with the process handling (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 9 years, 1 month 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/platform.h ('k') | runtime/bin/platform_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/platform_linux.cc
diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc
index 679f79cf3c242cab7bf5f98f5d05cc3762e564cb..1351c286699e2c4f1e4c7e5276d182bc46ac1e7a 100644
--- a/runtime/bin/platform_linux.cc
+++ b/runtime/bin/platform_linux.cc
@@ -4,10 +4,26 @@
#include "bin/platform.h"
+#include <signal.h>
#include <string.h>
#include <unistd.h>
+bool Platform::Initialize() {
+ // Turn off the signal handler for SIGPIPE as it causes the process
+ // to terminate on writing to a closed pipe. Without the signal
+ // handler error EPIPE is set instead.
+ struct sigaction act;
+ bzero(&act, sizeof(act));
+ act.sa_handler = SIG_IGN;
+ if (sigaction(SIGPIPE, &act, 0) != 0) {
+ perror("Setting signal handler failed");
+ return false;
+ }
+ return true;
+}
+
+
int Platform::NumberOfProcessors() {
return sysconf(_SC_NPROCESSORS_ONLN);
}
« no previous file with comments | « runtime/bin/platform.h ('k') | runtime/bin/platform_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698