[launchd-changes] [23526] trunk/launchd/src/launchd_core_logic.c
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 3 16:46:01 PST 2008
Revision: 23526
http://trac.macosforge.org/projects/launchd/changeset/23526
Author: zarzycki at apple.com
Date: 2008-03-03 16:46:00 -0800 (Mon, 03 Mar 2008)
Log Message:
-----------
Misc.
Modified Paths:
--------------
trunk/launchd/src/launchd_core_logic.c
Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c 2008-02-26 21:39:33 UTC (rev 23525)
+++ trunk/launchd/src/launchd_core_logic.c 2008-03-04 00:46:00 UTC (rev 23526)
@@ -6011,6 +6011,7 @@
struct machservice *ms;
struct ldcred *ldc = runtime_get_caller_creds();
kern_return_t kr;
+ bool per_pid_lookup = flags & BOOTSTRAP_PER_PID_SERVICE;
if (!launchd_assumes(j != NULL)) {
return BOOTSTRAP_NO_MEMORY;
@@ -6023,12 +6024,12 @@
}
#endif
- if (unlikely(!mspolicy_check(j, servicename, flags & BOOTSTRAP_PER_PID_SERVICE))) {
+ if (unlikely(!mspolicy_check(j, servicename, per_pid_lookup))) {
job_log(j, LOG_NOTICE, "Policy denied Mach service lookup: %s", servicename);
return BOOTSTRAP_NOT_PRIVILEGED;
}
- if (flags & BOOTSTRAP_PER_PID_SERVICE) {
+ if (per_pid_lookup) {
ms = jobmgr_lookup_service(j->mgr, servicename, false, target_pid);
} else {
ms = jobmgr_lookup_service(j->mgr, servicename, true, 0);
@@ -6044,9 +6045,10 @@
if (likely(ms)) {
job_assumes(j, machservice_port(ms) != MACH_PORT_NULL);
- job_log(j, LOG_DEBUG, "%sMach service lookup: %s", flags & BOOTSTRAP_PER_PID_SERVICE ? "Per PID " : "", servicename);
+ job_log(j, LOG_DEBUG, "%sMach service lookup: %s", per_pid_lookup ? "Per PID " : "", servicename);
- if (unlikely(j->lastlookup == ms && j->lastlookup_gennum == ms->gen_num && !j->per_user)) {
+ if (unlikely(!per_pid_lookup && j->lastlookup == ms && j->lastlookup_gennum == ms->gen_num && !j->per_user)) {
+ /* we need to think more about the per_pid_lookup logic before logging about repeated lookups */
job_log(j, LOG_APPLEONLY, "Performance: Please fix the framework that talks to \"%s\" to cache the Mach port for service: %s", ms->job->label, servicename);
}
@@ -6056,7 +6058,7 @@
*serviceportp = machservice_port(ms);
kr = BOOTSTRAP_SUCCESS;
- } else if (!(flags & BOOTSTRAP_PER_PID_SERVICE) && (inherited_bootstrap_port != MACH_PORT_NULL)) {
+ } else if (!per_pid_lookup && (inherited_bootstrap_port != MACH_PORT_NULL)) {
job_log(j, LOG_DEBUG, "Mach service lookup forwarded: %s", servicename);
job_assumes(j, vproc_mig_look_up2_forward(inherited_bootstrap_port, srp, servicename, 0, 0) == 0);
/* The previous routine moved the reply port, we're forced to return MIG_NO_REPLY now */
@@ -6070,7 +6072,7 @@
*/
return VPROC_ERR_TRY_PER_USER;
} else {
- job_log(j, LOG_DEBUG, "%sMach service lookup failed: %s", flags & BOOTSTRAP_PER_PID_SERVICE ? "Per PID " : "", servicename);
+ job_log(j, LOG_DEBUG, "%sMach service lookup failed: %s", per_pid_lookup ? "Per PID " : "", servicename);
kr = BOOTSTRAP_UNKNOWN_SERVICE;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20080303/621602c3/attachment.html
More information about the launchd-changes
mailing list