/* SPDX-License-Identifier: ISC */ #ifndef INIT_H #define INIT_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "service.h" #include "config.h" #include "util.h" #define ENVFILE ETCPATH "/initd.env" #define PROCFDDIR "/proc/self/fd" /********** runsvc.c **********/ /* Invoke the runsvc command to execute the comands of a service. Returns the pid of the child process containing the runsvc instance. */ 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); /********** print_status.c **********/ void print_status(const svc_run_data_t *rt); #endif /* INIT_H */