summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSelim Gurun <sgurun@google.com>2012-06-06 11:16:22 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-06 11:16:22 -0700
commitc2c49272a8d186f5abd688836f1deaaf06865f9d (patch)
tree70cbd98be2fe6481feecf9cee18db8845aa9f32b
parent27d9d3d22e980342fe7a2ab18777b59ad5e04a15 (diff)
parent86e0fcf830dcbada802ea2de22904e912dda5384 (diff)
downloadexternal_chromium-c2c49272a8d186f5abd688836f1deaaf06865f9d.zip
external_chromium-c2c49272a8d186f5abd688836f1deaaf06865f9d.tar.gz
external_chromium-c2c49272a8d186f5abd688836f1deaaf06865f9d.tar.bz2
am 86e0fcf8: DO NOT MERGE Convert exit calls to abort for Android
* commit '86e0fcf830dcbada802ea2de22904e912dda5384': DO NOT MERGE Convert exit calls to abort for Android
-rw-r--r--base/process_util_posix.cc36
-rw-r--r--net/disk_cache/rankings.cc4
2 files changed, 40 insertions, 0 deletions
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 47f04a9..3270079 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -155,7 +155,11 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, ucontext_t* context) {
write(STDERR_FILENO, buf, std::min(len, sizeof(buf) - 1));
#endif // ARCH_CPU_32_BITS
#endif // defined(OS_MACOSX)
+#ifdef ANDROID
+ abort();
+#else
_exit(1);
+#endif
}
void ResetChildSignalHandlersToDefaults() {
@@ -529,14 +533,22 @@ bool LaunchAppImpl(
int null_fd = HANDLE_EINTR(open("/dev/null", O_RDONLY));
if (null_fd < 0) {
RAW_LOG(ERROR, "Failed to open /dev/null");
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
}
file_util::ScopedFD null_fd_closer(&null_fd);
int new_fd = HANDLE_EINTR(dup2(null_fd, STDIN_FILENO));
if (new_fd != STDIN_FILENO) {
RAW_LOG(ERROR, "Failed to dup /dev/null for stdin");
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
}
if (start_new_process_group) {
@@ -544,7 +556,11 @@ bool LaunchAppImpl(
// starts off a new process group with pgid equal to its process ID.
if (setpgid(0, 0) < 0) {
RAW_LOG(ERROR, "setpgid failed");
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
}
}
#if defined(OS_MACOSX)
@@ -575,7 +591,11 @@ bool LaunchAppImpl(
// fd_shuffle1 is mutated by this call because it cannot malloc.
if (!ShuffleFileDescriptors(&fd_shuffle1))
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
CloseSuperfluousFds(fd_shuffle2);
@@ -585,7 +605,11 @@ bool LaunchAppImpl(
execvp(argv_cstr[0], argv_cstr.get());
RAW_LOG(ERROR, "LaunchApp: failed to execvp:");
RAW_LOG(ERROR, argv_cstr[0]);
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
} else {
// Parent process
if (wait) {
@@ -891,7 +915,11 @@ static bool GetAppOutputInternal(const CommandLine& cl, char* const envp[],
// in the child.
int dev_null = open("/dev/null", O_WRONLY);
if (dev_null < 0)
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
fd_shuffle1.push_back(InjectionArc(pipe_fd[1], STDOUT_FILENO, true));
fd_shuffle1.push_back(InjectionArc(dev_null, STDERR_FILENO, true));
@@ -903,7 +931,11 @@ static bool GetAppOutputInternal(const CommandLine& cl, char* const envp[],
std::back_inserter(fd_shuffle2));
if (!ShuffleFileDescriptors(&fd_shuffle1))
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
CloseSuperfluousFds(fd_shuffle2);
@@ -914,7 +946,11 @@ static bool GetAppOutputInternal(const CommandLine& cl, char* const envp[],
execvp(argv_cstr[0], argv_cstr.get());
else
execve(argv_cstr[0], argv_cstr.get(), envp);
+#ifdef ANDROID
+ abort();
+#else
_exit(127);
+#endif
}
default: // parent
{
diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc
index 902db1c..11c91d3 100644
--- a/net/disk_cache/rankings.cc
+++ b/net/disk_cache/rankings.cc
@@ -71,10 +71,14 @@ void TerminateSelf() {
// Windows does more work on _exit() than we would like, so we force exit.
TerminateProcess(GetCurrentProcess(), 0);
#elif defined(OS_POSIX)
+#if defined(ANDROID)
+ abort();
+#else
// On POSIX, _exit() will terminate the process with minimal cleanup,
// and it is cleaner than killing.
_exit(0);
#endif
+#endif
}
#endif // NDEBUG