aboutsummaryrefslogtreecommitdiff
path: root/initd/init.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <goliath@infraroot.at>2020-05-13 19:13:04 +0200
committerDavid Oberhollenzer <goliath@infraroot.at>2020-05-14 01:26:14 +0200
commitdbe89195b258c1101b5dd37dfbf5f0d71c25e0fa (patch)
tree6a4192ebe460b8a64f739209bc0269933304da9b /initd/init.h
parentf731537024c367368b728ed01c9232c3b1951589 (diff)
initd: split configuration handling into "config.c"
This commit splits off only the handling of the service configuration and handling of the run time state and adds an abstraction layer in the form of functions that have to be called to access the data. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'initd/init.h')
-rw-r--r--initd/init.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/initd/init.h b/initd/init.h
index 2c2adb1..813dedb 100644
--- a/initd/init.h
+++ b/initd/init.h
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <endian.h>
+#include <assert.h>
#include <stdio.h>
#include <errno.h>
#include <poll.h>
@@ -54,4 +55,43 @@ typedef struct {
*/
pid_t runsvc(service_t *svc);
+/********** config.c **********/
+
+/* load persistent configuration from disk */
+int config_load(void);
+
+svc_run_data_t *config_rt_data_by_pid(pid_t pid);
+
+/*
+ Get the next service that is waiting to be launched. Returns NULL if
+ the queue is empty.
+ */
+svc_run_data_t *config_dequeue(void);
+
+/*
+ Transition to a different target, if possible in the current state.
+
+ The transition may be ignored, e.g. if we are currently in the reboot
+ or shutdown target.
+ */
+void config_set_target(int tgt);
+
+/* get the current run time target from the configuration manager */
+int config_get_current_target(void);
+
+/*
+ Find out if the current target is completed, i.e. there are no more services
+ left in the queue and no active single shot services.
+ */
+bool config_is_current_target_complete(void);
+
+/* Ask whether we should respawn services in the current target */
+bool config_should_respawn(void);
+
+/* notify the configuration manager that a single shot service started */
+void config_singleshot_started(void);
+
+/* notify the configuration manager that a single shot service terminated */
+void config_singleshot_terminated(void);
+
#endif /* INIT_H */