Move stopped_reason_t to service_constants.h header.
[oweals/dinit.git] / src / includes / service-constants.h
1 #ifndef SERVICE_CONSTANTS_H
2 #define SERVICE_CONSTANTS_H
3
4 /* Service states */
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.
10 };
11
12 /* Service types */
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
18                 // "background".
19     SCRIPTED,   // Service requires an external command to start,
20                 // and a second command to stop
21     INTERNAL    // Internal service, runs no external process
22 };
23
24 /* Service events */
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
31 };
32
33 /* Shutdown types */
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
39 };
40
41 /* Reasons for why service stopped */
42 enum class stopped_reason_t
43 {
44     NORMAL,
45
46     // Start failures:
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
51
52     // Failure after starting:
53     TERMINATED // process terminated
54 };
55
56 #endif