[launchd-changes] [23099] trunk/launchd/src
source_changes at macosforge.org
source_changes at macosforge.org
Thu Feb 22 15:31:44 PST 2007
Revision: 23099
http://trac.macosforge.org/projects/launchd/changeset/23099
Author: zarzycki at apple.com
Date: 2007-02-22 15:31:44 -0800 (Thu, 22 Feb 2007)
Log Message:
-----------
Small bug fixes in the per-job Mach service concept.
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-22 22:41:38 UTC (rev 23098)
+++ trunk/launchd/src/launchd_core_logic.c 2007-02-22 23:31:44 UTC (rev 23099)
@@ -502,13 +502,29 @@
if (!SLIST_EMPTY(&j->machservices) && (tmp = launch_data_alloc(LAUNCH_DATA_DICTIONARY))) {
struct machservice *ms;
+
+ tmp3 = NULL;
SLIST_FOREACH(ms, &j->machservices, sle) {
- tmp2 = launch_data_new_machport(MACH_PORT_NULL);
- launch_data_dict_insert(tmp, tmp2, ms->name);
+ if (ms->per_pid) {
+ if (tmp3 == NULL) {
+ tmp3 = launch_data_alloc(LAUNCH_DATA_DICTIONARY);
+ }
+ if (tmp3) {
+ tmp2 = launch_data_new_machport(MACH_PORT_NULL);
+ launch_data_dict_insert(tmp3, tmp2, ms->name);
+ }
+ } else {
+ tmp2 = launch_data_new_machport(MACH_PORT_NULL);
+ launch_data_dict_insert(tmp, tmp2, ms->name);
+ }
}
launch_data_dict_insert(r, tmp, LAUNCH_JOBKEY_MACHSERVICES);
+
+ if (tmp3) {
+ launch_data_dict_insert(r, tmp3, LAUNCH_JOBKEY_PERJOBMACHSERVICES);
+ }
}
return r;
@@ -3532,12 +3548,11 @@
continue;
}
SLIST_FOREACH(ms, &ji->machservices, sle) {
- if (target_pid && !ms->per_pid) {
- continue;
+ if ((target_pid && ms->per_pid) || (!target_pid && !ms->per_pid)) {
+ if (strcmp(name, ms->name) == 0) {
+ return ms;
+ }
}
- if (strcmp(name, ms->name) == 0) {
- return ms;
- }
}
}
@@ -4482,7 +4497,9 @@
TAILQ_FOREACH(ji, &jm->jobs, sle) {
SLIST_FOREACH(ms, &ji->machservices, sle) {
- cnt++;
+ if (!ms->per_pid) {
+ cnt++;
+ }
}
}
@@ -4502,9 +4519,11 @@
TAILQ_FOREACH(ji, &jm->jobs, sle) {
SLIST_FOREACH(ms, &ji->machservices, sle) {
- strlcpy(service_names[cnt2], machservice_name(ms), sizeof(service_names[0]));
- service_actives[cnt2] = machservice_status(ms);
- cnt2++;
+ if (!ms->per_pid) {
+ strlcpy(service_names[cnt2], machservice_name(ms), sizeof(service_names[0]));
+ service_actives[cnt2] = machservice_status(ms);
+ cnt2++;
+ }
}
}
Modified: trunk/launchd/src/liblaunch_private.h
===================================================================
--- trunk/launchd/src/liblaunch_private.h 2007-02-22 22:41:38 UTC (rev 23098)
+++ trunk/launchd/src/liblaunch_private.h 2007-02-22 23:31:44 UTC (rev 23099)
@@ -50,6 +50,7 @@
#define LAUNCH_KEY_BATCHQUERY "BatchQuery"
#define LAUNCH_JOBKEY_ENTERKERNELDEBUGGERBEFOREKILL "EnterKernelDebuggerBeforeKill"
+#define LAUNCH_JOBKEY_PERJOBMACHSERVICES "PerJobMachServices"
#define LAUNCH_JOBKEY_MACH_KUNCSERVER "kUNCServer"
#define LAUNCH_JOBKEY_MACH_EXCEPTIONSERVER "ExceptionServer"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070222/bde082ac/attachment.html
More information about the launchd-changes
mailing list