]> git.saurik.com Git - apple/launchd.git/commitdiff
launchd-842.90.1.tar.gz os-x-1092 os-x-1093 v842.90.1
authorApple <opensource@apple.com>
Tue, 11 Mar 2014 19:54:28 +0000 (19:54 +0000)
committerApple <opensource@apple.com>
Tue, 11 Mar 2014 19:54:28 +0000 (19:54 +0000)
liblaunch/launch_priv.h
man/launchd.plist.5
src/core.c

index 518cf958effd72f48f7bb766b1ca8f81b8f93fd7..16e0aad67477e7a8a19e3d47b4893cc3ad29a5a8 100644 (file)
@@ -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_MACH_HOSTSPECIALPORT "HostSpecialPort"
 #define LAUNCH_JOBKEY_MACH_ENTERKERNELDEBUGGERONCLOSE "EnterKernelDebuggerOnClose"
 #define LAUNCH_JOBKEY_LOWPRIORITYBACKGROUNDIO "LowPriorityBackgroundIO"
+#define LAUNCH_JOBKEY_LEGACYTIMERS "LegacyTimers"
 
 #define LAUNCH_ENV_INSTANCEID "LaunchInstanceID"
 
 
 #define LAUNCH_ENV_INSTANCEID "LaunchInstanceID"
 
index f7f5a090a233cd23f7d77bd62aa0c678b4550113..6cdb638d82a3f696690d65ed8b671c190d3455f8 100644 (file)
@@ -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
 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 <boolean>
+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 <boolean>
 When a job dies,
 .Nm launchd
 .It Sy AbandonProcessGroup <boolean>
 When a job dies,
 .Nm launchd
index e5720e4d4db120221cad456cb8e383af2b8fc285..61c4c3309c25d1abb5fc6c661aadee6ea514ba51 100644 (file)
@@ -738,7 +738,8 @@ struct job_s {
                implicit_reap:1,
                system_app :1,
                joins_gui_session :1,
                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];
 };
 
        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_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':
                }
                break;
        case 'm':
@@ -4675,8 +4683,10 @@ job_start_child(job_t j)
                .task_throughput_qos_tier = THROUGHPUT_QOS_LAUNCH_DEFAULT_TIER,
        };
 
                .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
 #endif
 
 #if HAVE_RESPONSIBILITY