[launchd-changes] [23077] trunk/launchd/src

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 16 09:08:11 PST 2007


Revision: 23077
          http://trac.macosforge.org/projects/launchd/changeset/23077
Author:   zarzycki at apple.com
Date:     2007-02-16 09:08:11 -0800 (Fri, 16 Feb 2007)

Log Message:
-----------
Extra debug code for the kernel team.

Modified Paths:
--------------
    trunk/launchd/src/launchd_core_logic.c
    trunk/launchd/src/liblaunch_private.h

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-02-16 03:17:34 UTC (rev 23076)
+++ trunk/launchd/src/launchd_core_logic.c	2007-02-16 17:08:11 UTC (rev 23077)
@@ -101,7 +101,7 @@
 	SLIST_ENTRY(machservice) sle;
 	job_t			job;
 	mach_port_name_t	port;
-	unsigned int		isActive:1, reset:1, recv:1, hide:1, kUNCServer:1, must_match_uid:1;
+	unsigned int		isActive:1, reset:1, recv:1, hide:1, kUNCServer:1, must_match_uid:1, debug_on_close:1;
 	char			name[0];
 };
 
@@ -1676,7 +1676,7 @@
 
 		delta = (double)tvd.tv_sec + (double)tvd.tv_usec / (double)1000000;
 
-		job_log(j, tvd.tv_sec ? LOG_NOTICE : LOG_INFO, "Exited %f seconds after SIGTERM was sent", delta);
+		job_log(j, LOG_INFO, "Exited %f seconds after SIGTERM was sent", delta);
 	}
 
 	timeradd(&ru.ru_utime, &j->ru.ru_utime, &j->ru.ru_utime);
@@ -2886,7 +2886,7 @@
 		job_log(j, LOG_DEBUG, "Exited while removal was pending.");
 		return true;
 	} else if (j->mgr->shutting_down) {
-		job_log(j, LOG_NOTICE, "Exited while shutdown in progress. Processes remaining: %u", total_children);
+		job_log(j, LOG_DEBUG, "Exited while shutdown in progress. Processes remaining: %u", total_children);
 		return true;
 	} else if (!j->checkedin && (!SLIST_EMPTY(&j->sockets) || !SLIST_EMPTY(&j->machservices))) {
 		job_log(j, LOG_WARNING, "Failed to check-in!");
@@ -3196,7 +3196,9 @@
 		}
 	case LAUNCH_DATA_BOOL:
 		b = launch_data_get_bool(obj);
-		if (strcasecmp(key, LAUNCH_JOBKEY_MACH_RESETATCLOSE) == 0) {
+		if (strcasecmp(key, LAUNCH_JOBKEY_MACH_ENTERKERNELDEBUGGERONCLOSE) == 0) {
+			ms->debug_on_close = b;
+		} else if (strcasecmp(key, LAUNCH_JOBKEY_MACH_RESETATCLOSE) == 0) {
 			ms->reset = b;
 		} else if (strcasecmp(key, LAUNCH_JOBKEY_MACH_HIDEUNTILCHECKIN) == 0) {
 			ms->hide = b;
@@ -3569,6 +3571,11 @@
 void
 machservice_delete(struct machservice *ms)
 {
+	if (ms->debug_on_close) {
+		job_log(ms->job, LOG_NOTICE, "About to enter kernel debugger because of Mach port: 0x%x", ms->port);
+		job_assumes(ms->job, host_reboot(mach_host_self(), HOST_REBOOT_DEBUGGER) == KERN_SUCCESS);
+	}
+
 	if (ms->recv && job_assumes(ms->job, !ms->isActive)) {
 		job_assumes(ms->job, launchd_mport_close_recv(ms->port) == KERN_SUCCESS);
 	}

Modified: trunk/launchd/src/liblaunch_private.h
===================================================================
--- trunk/launchd/src/liblaunch_private.h	2007-02-16 03:17:34 UTC (rev 23076)
+++ trunk/launchd/src/liblaunch_private.h	2007-02-16 17:08:11 UTC (rev 23077)
@@ -55,6 +55,7 @@
 #define LAUNCH_JOBKEY_MACH_EXCEPTIONSERVER	"ExceptionServer"
 #define LAUNCH_JOBKEY_MACH_TASKSPECIALPORT	"TaskSpecialPort"
 #define LAUNCH_JOBKEY_MACH_HOSTSPECIALPORT	"HostSpecialPort"
+#define LAUNCH_JOBKEY_MACH_ENTERKERNELDEBUGGERONCLOSE	"EnterKernelDebuggerOnClose"
 
 typedef struct _launch *launch_t;
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070216/22738ada/attachment.html


More information about the launchd-changes mailing list