[launchd-changes] [23276] trunk/launchd/src/launchd_core_logic.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 8 14:11:59 PDT 2007


Revision: 23276
          http://trac.macosforge.org/projects/launchd/changeset/23276
Author:   zarzycki at apple.com
Date:     2007-06-08 14:11:59 -0700 (Fri, 08 Jun 2007)

Log Message:
-----------
Small bug fixes.

Modified Paths:
--------------
    trunk/launchd/src/launchd_core_logic.c

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-06-07 23:22:31 UTC (rev 23275)
+++ trunk/launchd/src/launchd_core_logic.c	2007-06-08 21:11:59 UTC (rev 23276)
@@ -2727,9 +2727,8 @@
 void
 calendarinterval_setalarm(job_t j, struct calendarinterval *ci)
 {
-	static time_t last_list_head_when;
 	struct calendarinterval *ci_iter, *ci_prev = NULL;
-	time_t later;
+	time_t later, head_later;
 
 	later = cronemu(ci->when.tm_mon, ci->when.tm_mday, ci->when.tm_hour, ci->when.tm_min);
 
@@ -2764,13 +2763,12 @@
 		}
 	}
 
-	if (last_list_head_when == LIST_FIRST(&sorted_calendar_events)->when_next) {
-		return;
-	}
+	head_later = LIST_FIRST(&sorted_calendar_events)->when_next;
 
-	last_list_head_when = LIST_FIRST(&sorted_calendar_events)->when_next;
+	/* Workaround 5225889 */
+	kevent_mod((uintptr_t)&sorted_calendar_events, EVFILT_TIMER, EV_DELETE, 0, 0, root_jobmgr);
 
-	if (job_assumes(j, kevent_mod((uintptr_t)&sorted_calendar_events, EVFILT_TIMER, EV_ADD, NOTE_ABSOLUTE|NOTE_SECONDS, last_list_head_when, root_jobmgr) != -1)) {
+	if (job_assumes(j, kevent_mod((uintptr_t)&sorted_calendar_events, EVFILT_TIMER, EV_ADD, NOTE_ABSOLUTE|NOTE_SECONDS, head_later, root_jobmgr) != -1)) {
 		char time_string[100];
 		size_t time_string_len;
 
@@ -3156,7 +3154,7 @@
 	struct calendarinterval *ci = LIST_FIRST(&sorted_calendar_events);
 	time_t now = time(NULL);
 
-	if (ci && ci->when_next < now) {
+	if (ci && (ci->when_next < now)) {
 		jobmgr_assumes(root_jobmgr, kill(getpid(), SIGUSR1) != -1);
 	}
 }
@@ -3170,7 +3168,7 @@
 	LIST_FOREACH_SAFE(ci, &sorted_calendar_events, global_sle, ci_next) {
 		job_t j = ci->job;
 
-		if (ci->when_next >= now) {
+		if (ci->when_next > now) {
 			break;
 		}
 
@@ -3453,8 +3451,8 @@
 		return false;
 	}
 
-	if (j->start_pending && j->start_time == 0) {
-		job_log(j, LOG_DEBUG, "KeepAlive check: job needs to run at least once.");
+	if (j->start_pending) {
+		job_log(j, LOG_DEBUG, "KeepAlive check: Pent-up non-IPC launch criteria.");
 		return true;
 	}
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070608/1d7d71e7/attachment.html


More information about the launchd-changes mailing list