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

Unified Diff: runtime/bin/process_linux.cc

Issue 165723007: Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
Index: runtime/bin/process_linux.cc
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index 037dd16c39b7c90b9a570ba26f7375a6a57b6d5f..2f8357bbb8ca2b6e8d534f264b366ddbfc3467b6 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -16,9 +16,9 @@
#include <sys/wait.h> // NOLINT
#include <unistd.h> // NOLINT
+#include "platform/signal_blocker.h"
#include "bin/fdutils.h"
#include "bin/log.h"
-#include "bin/signal_blocker.h"
#include "bin/thread.h"
@@ -151,7 +151,7 @@ class ExitCodeHandler {
running_ = false;
// Fork to wake up waitpid.
- if (TEMP_FAILURE_RETRY(fork()) == 0) {
+ if (fork() == 0) {
exit(0);
}
@@ -274,7 +274,7 @@ int Process::Start(const char* path,
int exec_control[2]; // Pipe to get the result from exec.
int result;
- result = TEMP_FAILURE_RETRY(pipe(read_in));
+ result = pipe(read_in);
if (result < 0) {
SetChildOsErrorMessage(os_error_message);
Log::PrintErr("Error pipe creation failed: %s\n", *os_error_message);
@@ -282,7 +282,7 @@ int Process::Start(const char* path,
}
FDUtils::SetCloseOnExec(read_in[0]);
- result = TEMP_FAILURE_RETRY(pipe(read_err));
+ result = pipe(read_err);
if (result < 0) {
SetChildOsErrorMessage(os_error_message);
TEMP_FAILURE_RETRY(close(read_in[0]));
@@ -292,7 +292,7 @@ int Process::Start(const char* path,
}
FDUtils::SetCloseOnExec(read_err[0]);
- result = TEMP_FAILURE_RETRY(pipe(write_out));
+ result = pipe(write_out);
if (result < 0) {
SetChildOsErrorMessage(os_error_message);
TEMP_FAILURE_RETRY(close(read_in[0]));
@@ -304,7 +304,7 @@ int Process::Start(const char* path,
}
FDUtils::SetCloseOnExec(write_out[1]);
- result = TEMP_FAILURE_RETRY(pipe(exec_control));
+ result = pipe(exec_control);
if (result < 0) {
SetChildOsErrorMessage(os_error_message);
TEMP_FAILURE_RETRY(close(read_in[0]));
@@ -349,7 +349,7 @@ int Process::Start(const char* path,
program_environment[environment_length] = NULL;
}
- pid = TEMP_FAILURE_RETRY(fork());
+ pid = fork();
if (pid < 0) {
SetChildOsErrorMessage(os_error_message);
delete[] program_arguments;
@@ -391,8 +391,7 @@ int Process::Start(const char* path,
}
TEMP_FAILURE_RETRY(close(read_err[1]));
- if (working_directory != NULL &&
- TEMP_FAILURE_RETRY(chdir(working_directory)) == -1) {
+ if (working_directory != NULL && chdir(working_directory) == -1) {
ReportChildError(exec_control[1]);
}
@@ -400,8 +399,7 @@ int Process::Start(const char* path,
environ = program_environment;
}
- TEMP_FAILURE_RETRY(
- execvp(path, const_cast<char* const*>(program_arguments)));
+ execvp(path, const_cast<char* const*>(program_arguments));
ReportChildError(exec_control[1]);
}
@@ -415,7 +413,7 @@ int Process::Start(const char* path,
delete[] program_environment;
int event_fds[2];
- result = TEMP_FAILURE_RETRY(pipe(event_fds));
+ result = pipe(event_fds);
if (result < 0) {
SetChildOsErrorMessage(os_error_message);
TEMP_FAILURE_RETRY(close(read_in[0]));
@@ -618,7 +616,7 @@ bool Process::Wait(intptr_t pid,
bool Process::Kill(intptr_t id, int signal) {
- return (TEMP_FAILURE_RETRY(kill(id, signal)) != -1);
+ return kill(id, signal) != -1;
}
@@ -673,12 +671,12 @@ intptr_t Process::SetSignalHandler(intptr_t signal) {
}
if (!found) return -1;
int fds[2];
- if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS(pipe(fds)) != 0) {
+ if (pipe(fds) != 0) {
return -1;
}
if (!FDUtils::SetNonBlocking(fds[0])) {
- VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[0]));
- VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[1]));
+ VOID_TEMP_FAILURE_RETRY(close(fds[0]));
+ VOID_TEMP_FAILURE_RETRY(close(fds[1]));
return -1;
}
ThreadSignalBlocker blocker(kSignalsCount, kSignals);
@@ -700,11 +698,10 @@ intptr_t Process::SetSignalHandler(intptr_t signal) {
for (int i = 0; i < kSignalsCount; i++) {
sigaddset(&act.sa_mask, kSignals[i]);
}
- int status = TEMP_FAILURE_RETRY_BLOCK_SIGNALS(
- sigaction(signal, &act, NULL));
+ int status = sigaction(signal, &act, NULL);
if (status < 0) {
- VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[0]));
- VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[1]));
+ VOID_TEMP_FAILURE_RETRY(close(fds[0]));
+ VOID_TEMP_FAILURE_RETRY(close(fds[1]));
return -1;
}
}
@@ -741,7 +738,7 @@ void Process::ClearSignalHandler(intptr_t signal) {
struct sigaction act;
bzero(&act, sizeof(act));
act.sa_handler = SIG_DFL;
- VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL));
+ sigaction(signal, &act, NULL);
}
}

Powered by Google App Engine
This is Rietveld 408576698