From: Apple Date: Tue, 11 Mar 2014 19:54:28 +0000 (+0000) Subject: launchd-842.90.1.tar.gz X-Git-Tag: os-x-1092^0 X-Git-Url: https://git.saurik.com/apple/launchd.git/commitdiff_plain/f9823965ed8d9a1ea414140f57766208430badd0?ds=inline launchd-842.90.1.tar.gz --- diff --git a/liblaunch/launch_priv.h b/liblaunch/launch_priv.h index 518cf95..16e0aad 100644 --- a/liblaunch/launch_priv.h +++ b/liblaunch/launch_priv.h @@ -102,6 +102,7 @@ __BEGIN_DECLS #define LAUNCH_JOBKEY_MACH_HOSTSPECIALPORT "HostSpecialPort" #define LAUNCH_JOBKEY_MACH_ENTERKERNELDEBUGGERONCLOSE "EnterKernelDebuggerOnClose" #define LAUNCH_JOBKEY_LOWPRIORITYBACKGROUNDIO "LowPriorityBackgroundIO" +#define LAUNCH_JOBKEY_LEGACYTIMERS "LegacyTimers" #define LAUNCH_ENV_INSTANCEID "LaunchInstanceID" diff --git a/man/launchd.plist.5 b/man/launchd.plist.5 index f7f5a09..6cdb638 100644 --- a/man/launchd.plist.5 +++ b/man/launchd.plist.5 @@ -361,6 +361,13 @@ none. Interactive jobs are critical to maintaining a responsive user experience, and this key should only be used if an app's ability to be responsive depends on it, and cannot be made Adaptive. .El +.It Sy LegacyTimers +This optional key controls the behavior of timers created by the job. By default +on OS X Mavericks version 10.9 and later, timers created by launchd jobs are +coalesced. Batching the firing of timers with similar deadlines improves the +overall energy efficiency of the system. If this key is set to true, timers +created by the job will opt into less efficient but more precise behavior and +not be coalesced with other timers. .It Sy AbandonProcessGroup When a job dies, .Nm launchd diff --git a/src/core.c b/src/core.c index e5720e4..61c4c33 100644 --- a/src/core.c +++ b/src/core.c @@ -738,7 +738,8 @@ struct job_s { implicit_reap:1, system_app :1, joins_gui_session :1, - low_priority_background_io :1; + low_priority_background_io :1, + legacy_timers :1; const char label[0]; }; @@ -2469,6 +2470,13 @@ job_import_bool(job_t j, const char *key, bool value) } else if (strcasecmp(key, LAUNCH_JOBKEY_LOWPRIORITYBACKGROUNDIO) == 0) { j->low_priority_background_io = true; found_key = true; + } else if (strcasecmp(key, LAUNCH_JOBKEY_LEGACYTIMERS) == 0) { +#if !TARGET_OS_EMBEDDED + j->legacy_timers = value; +#else // !TARGET_OS_EMBEDDED + job_log(j, LOG_ERR, "This key is not supported on this platform: %s", key); +#endif // !TARGET_OS_EMBEDDED + found_key = true; } break; case 'm': @@ -4675,8 +4683,10 @@ job_start_child(job_t j) .task_throughput_qos_tier = THROUGHPUT_QOS_LAUNCH_DEFAULT_TIER, }; - kr = task_policy_set(mach_task_self(), TASK_BASE_QOS_POLICY, (task_policy_t)&qosinfo, TASK_QOS_POLICY_COUNT); - (void)job_assumes_zero_p(j, kr); + if (!j->legacy_timers) { + kr = task_policy_set(mach_task_self(), TASK_BASE_QOS_POLICY, (task_policy_t)&qosinfo, TASK_QOS_POLICY_COUNT); + (void)job_assumes_zero_p(j, kr); + } #endif #if HAVE_RESPONSIBILITY