1 #ifndef SERVICE_CONSTANTS_H
2 #define SERVICE_CONSTANTS_H
5 enum class service_state_t {
6 STOPPED, // service is not running.
7 STARTING, // service is starting, and will start (or fail to start) in time.
8 STARTED, // service is running,
9 STOPPING // service script is stopping and will stop.
13 enum class service_type_t {
14 DUMMY, // Dummy service, used to detect cyclice dependencies
15 PROCESS, // Service runs as a process, and can be stopped by
16 // sending the process a signal (usually SIGTERM)
17 BGPROCESS, // Service runs as a process which "daemonizes" to run in the
19 SCRIPTED, // Service requires an external command to start,
20 // and a second command to stop
21 INTERNAL // Internal service, runs no external process
25 enum class service_event_t {
26 STARTED, // Service was started (reached STARTED state)
27 STOPPED, // Service was stopped (reached STOPPED state)
28 FAILEDSTART, // Service failed to start (possibly due to dependency failing)
29 STARTCANCELLED, // Service was set to be started but a stop was requested
30 STOPCANCELLED // Service was set to be stopped but a start was requested
34 enum class shutdown_type_t {
35 CONTINUE, // Continue normal boot sequence (used after single-user shell)
36 HALT, // Halt system without powering down
37 POWEROFF, // Power off system
38 REBOOT // Reboot system
41 /* Reasons for why service stopped */
42 enum class stopped_reason_t
47 DEPFAILED, // A dependency failed to start
48 FAILED, // failed to start (process terminated)
49 EXECFAILED, // failed to start (couldn't launch process)
50 TIMEDOUT, // timed out when starting
52 // Failure after starting:
53 TERMINATED // process terminated