[launchd-changes] [23071] trunk/launchd/src

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 15 10:54:56 PST 2007


Revision: 23071
          http://trac.macosforge.org/projects/launchd/changeset/23071
Author:   zarzycki at apple.com
Date:     2007-02-15 10:54:55 -0800 (Thu, 15 Feb 2007)

Log Message:
-----------
Add a UPS flag.

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

Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c	2007-02-15 18:26:22 UTC (rev 23070)
+++ trunk/launchd/src/launchd_core_logic.c	2007-02-15 18:54:55 UTC (rev 23071)
@@ -203,7 +203,7 @@
 	char *jm_stdout;
 	char *jm_stderr;
 	unsigned int global_on_demand_cnt;
-	unsigned int transfer_bstrap:1, sent_stop_to_hopeful_jobs:1, shutting_down:1, power_cycle:1;
+	unsigned int transfer_bstrap:1, sent_stop_to_hopeful_jobs:1, shutting_down:1, power_cycle:1, ups_delay:1;
 	char name[0];
 };
 
@@ -588,7 +588,16 @@
 		SLIST_REMOVE(&jm->parentmgr->submgrs, jm, jobmgr_s, sle);
 		jobmgr_tickle(jm->parentmgr);
 	} else if (getpid() == 1) {
-		jobmgr_assumes(jm,  reboot(jm->power_cycle ? RB_AUTOBOOT : RB_HALT) != -1);
+		int flags = 0;
+
+		if (!jm->power_cycle) {
+			flags |= RB_HALT;
+		}
+		if (!jm->ups_delay) {
+			flags |= RB_UPSDELAY;
+		}
+
+		jobmgr_assumes(jm,  reboot(flags) != -1);
 	} else {
 		exit(EXIT_SUCCESS);
 	}
@@ -4130,6 +4139,9 @@
 	if (flags & POWEROFF_RESET) {
 		root_jobmgr->power_cycle = true;
 	}
+	if (flags & POWEROFF_UPSDELAY) {
+		root_jobmgr->ups_delay = true;
+	}
 
 	launchd_shutdown();
 

Modified: trunk/launchd/src/poweroff.h
===================================================================
--- trunk/launchd/src/poweroff.h	2007-02-15 18:26:22 UTC (rev 23070)
+++ trunk/launchd/src/poweroff.h	2007-02-15 18:54:55 UTC (rev 23071)
@@ -26,6 +26,7 @@
 __BEGIN_DECLS
 
 #define POWEROFF_RESET	1
+#define POWEROFF_UPSDELAY	2
 
 /* Returns NULL on success. Not NULL on failure */
 

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


More information about the launchd-changes mailing list