| Index: runtime/bin/platform_macos.cc
|
| diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc
|
| index 02745aa77b1cba756e11fe6686855e4586ebe24a..b2182496bcd3ba72b5967339bc5cc6c056f0fec5 100644
|
| --- a/runtime/bin/platform_macos.cc
|
| +++ b/runtime/bin/platform_macos.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);
|
| }
|
|
|