[launchd-changes] [23938] branches/PR-7178164/launchd/src/launchd_core_logic.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 8 16:31:45 PDT 2009


Revision: 23938
          http://trac.macosforge.org/projects/launchd/changeset/23938
Author:   dsorresso at apple.com
Date:     2009-10-08 16:31:44 -0700 (Thu, 08 Oct 2009)
Log Message:
-----------
Looks like it actually works now.

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 00:53:09 UTC (rev 23937)
+++ branches/PR-7178164/launchd/src/launchd_core_logic.c	2009-10-08 23:31:44 UTC (rev 23938)
@@ -470,9 +470,9 @@
 	int log_redirect_fd;
 	int nice;
 	int stdout_err_fd;
-	uint32_t jetsam_priority;
-	uint32_t jetsam_memlimit;
-	uint32_t main_thread_priority;
+	int32_t jetsam_priority;
+	int32_t jetsam_memlimit;
+	int32_t main_thread_priority;
 	uint32_t timeout;
 	uint32_t exit_timeout;
 	uint64_t sent_signal_time;
@@ -8920,7 +8920,7 @@
 void
 jetsam_property_setup(launch_data_t obj, const char *key, job_t j)
 {
-	job_log(j, LOG_NOTICE, "Importing Jetsam job...");
+	job_log(j, LOG_NOTICE, "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);
@@ -8944,7 +8944,7 @@
 	if( !launchd_assumes(launch_data_get_type(priorities) == LAUNCH_DATA_ARRAY) ) {
 		return EINVAL;
 	}
-	
+
 	jobmgr_t jm = NULL;
 #if !TARGET_OS_EMBEDDED
 	/* For testing. */
@@ -8989,12 +8989,10 @@
 			ji->jetsam_frontmost = launch_data_get_bool(frontmost);
 		}
 		
-		/* If the job wasn't in the Jetsam list before, add it. */
-		if( job_assumes(ji, ji->jetsam_priority || ji->jetsam_frontmost || ji->jetsam_memlimit) ) {
-			if( !ji->jetsam_properties ) {
-				LIST_INSERT_HEAD(&ji->mgr->jetsam_jobs, ji, jetsam_sle);
-				ji->mgr->jetsam_jobs_cnt++;
-			}
+		if( !ji->jetsam_properties ) {
+			ji->jetsam_properties = true;
+			LIST_INSERT_HEAD(&ji->mgr->jetsam_jobs, ji, jetsam_sle);
+			ji->mgr->jetsam_jobs_cnt++;
 		}
 	}
 	
@@ -9039,9 +9037,8 @@
 				jpris[i].hiwat_pages = jobs[i]->jetsam_memlimit;
 			}
 			
-			int _result = 0;
-			launchd_assumes((_result = sysctlbyname("kern.memorystatus_priority_list", NULL, NULL, &jpris[0], totalpris * sizeof(jetsam_priority_entry_t))) != -1);
-			result = _result != 0 ? errno : 0;
+			launchd_assumes((result = sysctlbyname("kern.memorystatus_priority_list", NULL, NULL, &jpris[0], totalpris * sizeof(jetsam_priority_entry_t))) != -1);
+			result = result != 0 ? errno : 0;
 			
 			free(jpris);
 		}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-changes/attachments/20091008/99cfa99a/attachment.html>


More information about the launchd-changes mailing list