[launchd-changes] [22963] trunk/launchd/src/launchd.c
source_changes at macosforge.org
source_changes at macosforge.org
Mon Dec 4 08:51:36 PST 2006
Revision: 22963
http://trac.macosforge.org/projects/launchd/changeset/22963
Author: zarzycki at apple.com
Date: 2006-12-04 08:51:34 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
<rdar://problem/4860735> CrashTracer: 6 crashes in launchd at launchd: main + 1672
Modified Paths:
--------------
trunk/launchd/src/launchd.c
Modified: trunk/launchd/src/launchd.c
===================================================================
--- trunk/launchd/src/launchd.c 2006-11-29 22:10:38 UTC (rev 22962)
+++ trunk/launchd/src/launchd.c 2006-12-04 16:51:34 UTC (rev 22963)
@@ -98,6 +98,7 @@
static bool get_network_state(void);
static void monitor_networking_state(void);
static void fatal_signal_handler(int sig, siginfo_t *si, void *uap);
+static void handle_pid1_crashes_separately(void);
static bool re_exec_in_single_user_mode = false;
static char *pending_stdout = NULL;
@@ -121,7 +122,6 @@
SIGTTIN, SIGTTOU, SIGIO, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF,
SIGWINCH, SIGINFO, SIGUSR1, SIGUSR2
};
- struct sigaction fsa;
bool sflag = false, dflag = false, Dflag = false;
char ldconf[PATH_MAX] = PID1LAUNCHD_CONF;
const char *h = getenv("HOME");
@@ -301,23 +301,35 @@
job_dispatch(fbj, true);
}
- if (getpid() == 1 && !job_active(rlcj)) {
- init_pre_kevent();
+ if (getpid() == 1) {
+ handle_pid1_crashes_separately();
+
+ if (!job_active(rlcj)) {
+ init_pre_kevent();
+ }
}
+ launchd_runtime();
+}
+
+void
+handle_pid1_crashes_separately(void)
+{
+ struct sigaction fsa;
+
switch (setjmp(doom_doom_doom)) {
- case SIGILL:
- case SIGFPE:
- syslog(LOG_EMERG, "We crashed at instruction: %p", crash_addr);
- abort();
- case SIGBUS:
- case SIGSEGV:
- syslog(LOG_EMERG, "We crashed trying to read/write: %p", crash_addr);
- abort();
- default:
- abort();
- case 0:
- break;
+ case SIGILL:
+ case SIGFPE:
+ syslog(LOG_EMERG, "We crashed at instruction: %p", crash_addr);
+ abort();
+ case SIGBUS:
+ case SIGSEGV:
+ syslog(LOG_EMERG, "We crashed trying to read/write: %p", crash_addr);
+ abort();
+ default:
+ abort();
+ case 0:
+ break;
}
fsa.sa_sigaction = fatal_signal_handler;
@@ -328,8 +340,6 @@
launchd_assumes(sigaction(SIGFPE, &fsa, NULL) != -1);
launchd_assumes(sigaction(SIGBUS, &fsa, NULL) != -1);
launchd_assumes(sigaction(SIGSEGV, &fsa, NULL) != -1);
-
- launchd_runtime();
}
void
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061204/904fcb11/attachment.html
More information about the launchd-changes
mailing list