Revision: 23939 http://trac.macosforge.org/projects/launchd/changeset/23939 Author: dsorresso@apple.com Date: 2009-10-12 15:23:13 -0700 (Mon, 12 Oct 2009) Log Message: ----------- Added legacy support for old Jetsam plists. Modified Paths: -------------- branches/PR-7178164/launchd/src/launchd_core_logic.c Modified: branches/PR-7178164/launchd/src/launchd_core_logic.c =================================================================== --- branches/PR-7178164/launchd/src/launchd_core_logic.c 2009-10-08 23:31:44 UTC (rev 23938) +++ branches/PR-7178164/launchd/src/launchd_core_logic.c 2009-10-12 22:23:13 UTC (rev 23939) @@ -1897,6 +1897,17 @@ j->main_thread_priority = value; } break; + case 'j': + case 'J': + if( strcasecmp(key, LAUNCH_JOBKEY_JETSAMPRIORITY) == 0 ) { + job_log(j, LOG_WARNING | LOG_CONSOLE, "Please change the JetsamPriority key to be in a dictionary named JetsamProperties."); + + launch_data_t pri = launch_data_new_integer(value); + if( job_assumes(j, pri != NULL) ) { + jetsam_property_setup(pri, LAUNCH_JOBKEY_JETSAMPRIORITY, j); + launch_data_free(pri); + } + } case 'n': case 'N': if (strcasecmp(key, LAUNCH_JOBKEY_NICE) == 0) { @@ -2048,11 +2059,6 @@ case 'j': case 'J': if( strcasecmp(key, LAUNCH_JOBKEY_JETSAMPROPERTIES) == 0 ) { - if( job_assumes(j, !j->jetsam_properties) ) { - LIST_INSERT_HEAD(&j->mgr->jetsam_jobs, j, jetsam_sle); - j->mgr->jetsam_jobs_cnt++; - j->jetsam_properties = true; - } launch_data_dict_iterate(value, (void (*)(launch_data_t, const char *, void *))jetsam_property_setup, j); } case 'e': @@ -8920,15 +8926,17 @@ void jetsam_property_setup(launch_data_t obj, const char *key, job_t j) { - job_log(j, LOG_NOTICE, "Setting Jetsam properties for job..."); + job_log(j, LOG_NOTICE | LOG_CONSOLE, "Setting Jetsam properties for job..."); if( strcasecmp(key, LAUNCH_JOBKEY_JETSAMPRIORITY) == 0 && launch_data_get_type(obj) == LAUNCH_DATA_INTEGER ) { j->jetsam_priority = (typeof(j->jetsam_priority))launch_data_get_integer(obj); - job_log(j, LOG_NOTICE, "Priority: %d", j->jetsam_priority); + job_log(j, LOG_NOTICE | LOG_CONSOLE, "Priority: %d", j->jetsam_priority); } else if( strcasecmp(key, LAUNCH_JOBKEY_JETSAMMEMORYLIMIT) == 0 && launch_data_get_type(obj) == LAUNCH_DATA_INTEGER ) { j->jetsam_memlimit = (typeof(j->jetsam_memlimit))launch_data_get_integer(obj); - job_log(j, LOG_NOTICE, "Memory limit: %d", j->jetsam_memlimit); + job_log(j, LOG_NOTICE | LOG_CONSOLE, "Memory limit: %d", j->jetsam_memlimit); } else if( strcasecmp(key, LAUNCH_KEY_JETSAMFRONTMOST) == 0 ) { - /* Ignore. We only recognize this key so we don't complain. You can't set this in a plist. */ + /* Ignore. We only recognize this key so we don't complain when we get SpringBoard's request. + * You can't set this in a plist. + */ } else if( strcasecmp(key, LAUNCH_KEY_JETSAMLABEL) == 0 ) { /* Ignore. This key is present in SpringBoard's request dictionary, so we don't want to * complain about it. @@ -8936,6 +8944,12 @@ } else { job_log(j, LOG_ERR, "Unknown Jetsam key: %s", key); } + + if( unlikely(!j->jetsam_properties) ) { + j->jetsam_properties = true; + LIST_INSERT_HEAD(&j->mgr->jetsam_jobs, j, jetsam_sle); + j->mgr->jetsam_jobs_cnt++; + } } int @@ -8988,12 +9002,6 @@ if( (frontmost = launch_data_dict_lookup(ldi, LAUNCH_KEY_JETSAMFRONTMOST)) && launch_data_get_type(frontmost) == LAUNCH_DATA_BOOL ) { ji->jetsam_frontmost = launch_data_get_bool(frontmost); } - - if( !ji->jetsam_properties ) { - ji->jetsam_properties = true; - LIST_INSERT_HEAD(&ji->mgr->jetsam_jobs, ji, jetsam_sle); - ji->mgr->jetsam_jobs_cnt++; - } } i = 0;
participants (1)
-
source_changes@macosforge.org