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

Unified Diff: base/process_util_posix.cc

Issue 3302009: [Mac] Move the reset of signal handlers to be very soon after the fork, befor... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_posix.cc
===================================================================
--- base/process_util_posix.cc (revision 58482)
+++ base/process_util_posix.cc (working copy)
@@ -109,6 +109,15 @@
_exit(1);
}
+void ResetChildSignalHandlersToDefaults() {
+ // The previous signal handlers are likely to be meaningless in the child's
+ // context so we reset them to the defaults for now. http://crbug.com/44953
+ // These signal handlers are setup in browser_main.cc:BrowserMain
+ signal(SIGTERM, SIG_DFL);
+ signal(SIGHUP, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+}
+
} // anonymous namespace
ProcessId GetCurrentProcId() {
@@ -323,6 +332,9 @@
case -1:
return pid;
case 0: { // child
+ // Must reset signal handlers before doing any mach IPC, as the mach IPC
+ // calls can potentially hang forever.
+ ResetChildSignalHandlersToDefaults();
MachSendMessage child_message(/* id= */0);
if (!child_message.AddDescriptor(mach_task_self())) {
LOG(ERROR) << "child AddDescriptor(mach_task_self()) failed.";
@@ -529,12 +541,10 @@
RestoreDefaultExceptionHandler();
#endif
- // The previous signal handlers are likely to be meaningless in the child's
- // context so we reset them to the defaults for now. http://crbug.com/44953
- // These signal handlers are setup in browser_main.cc:BrowserMain
- signal(SIGTERM, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
- signal(SIGINT, SIG_DFL);
+ // On mac, the signal handlers are reset in |fork_and_get_task()|.
+#if !defined(OS_MACOSX)
+ ResetChildSignalHandlersToDefaults();
+#endif
#if 0
// When debugging it can be helpful to check that we really aren't making
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698