[launchd-changes] [23909] trunk/launchd/src
source_changes at macosforge.org
source_changes at macosforge.org
Mon Apr 27 10:02:42 PDT 2009
Revision: 23909
http://trac.macosforge.org/projects/launchd/changeset/23909
Author: dsorresso at apple.com
Date: 2009-04-27 10:02:41 -0700 (Mon, 27 Apr 2009)
Log Message:
-----------
<rdar://problem/6826450>
Modified Paths:
--------------
trunk/launchd/src/launch_priv.h
trunk/launchd/src/launchd_core_logic.c
Modified: trunk/launchd/src/launch_priv.h
===================================================================
--- trunk/launchd/src/launch_priv.h 2009-04-24 22:51:09 UTC (rev 23908)
+++ trunk/launchd/src/launch_priv.h 2009-04-27 17:02:41 UTC (rev 23909)
@@ -61,8 +61,8 @@
#define LAUNCH_JOBKEY_JETSAMPRIORITY "JetsamPriority"
#define LAUNCH_JOBKEY_SECURITYSESSIONUUID "SecuritySessionUUID"
-#define LAUNCH_JOBKEY_EMBEDDEDSHUTDOWNAUTHORITY "EmbeddedShutdownAuthority"
#define LAUNCH_JOBKEY_EMBEDDEDPRIVILEGEDISPENSATION "EmbeddedPrivilegeDispensation"
+#define LAUNCH_JOBKEY_EMBEDDEDMAINTHREADPRIORITY "EmbeddedMainThreadPriority"
#define LAUNCH_JOBKEY_ENTERKERNELDEBUGGERBEFOREKILL "EnterKernelDebuggerBeforeKill"
#define LAUNCH_JOBKEY_PERJOBMACHSERVICES "PerJobMachServices"
Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c 2009-04-24 22:51:09 UTC (rev 23908)
+++ trunk/launchd/src/launchd_core_logic.c 2009-04-27 17:02:41 UTC (rev 23909)
@@ -78,6 +78,7 @@
#include <spawn.h>
#include <libproc.h>
#include <malloc/malloc.h>
+#include <pthread.h>
#if HAVE_SANDBOX
#define __APPLE_API_PRIVATE
#include <sandbox.h>
@@ -464,6 +465,7 @@
int nice;
int stdout_err_fd;
long long jetsam_priority;
+ long long main_thread_priority;
uint32_t timeout;
uint32_t exit_timeout;
uint64_t sent_signal_time;
@@ -1887,6 +1889,8 @@
} else {
j->exit_timeout = (typeof(j->exit_timeout)) value;
}
+ } else if( strcasecmp(key, LAUNCH_JOBKEY_EMBEDDEDMAINTHREADPRIORITY) == 0 ) {
+ j->main_thread_priority = value;
}
break;
case 'j':
@@ -4185,7 +4189,16 @@
job_assumes(j, proc_setpcontrol(PROC_SETPC_TERMINATE) == 0);
}
#endif
-
+
+#if TARGET_OS_EMBEDDED
+ if( j->main_thread_priority != 0 ) {
+ struct sched_param params;
+ bzero(¶ms, sizeof(params));
+ params.sched_priority = j->main_thread_priority;
+ job_assumes(j, pthread_setschedparam(pthread_self(), SCHED_OTHER, ¶ms) != -1);
+ }
+#endif
+
/*
* We'd like to call setsid() unconditionally, but we have reason to
* believe that prevents launchd from being able to send signals to
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-changes/attachments/20090427/d504d549/attachment.html>
More information about the launchd-changes
mailing list