blob: 22345187c3afd88d11da651418798abbcb405ddf [file] [log] [blame]
Tyler Chatowa79419d2020-08-12 20:12:11 -07001namespace aos.starter;
2
3enum State : short {
4 // Process has recently stopped and is waiting to restart.
5 WAITING,
6
7 // Process has forked, waiting to move to RUNNING after verifying it started
8 // successfully.
9 STARTING,
10
11 // Process is running. pid, id, and last_start_time represent the current
12 // running process.
13 RUNNING,
14
15 // Process has been sent SIGTERM to nicely stop and starter is waiting for it
16 // to exit.
17 STOPPING,
18
19 // Process is stopped and will not automatically restart unless sent a command
20 STOPPED
21}
22
23enum LastStopReason : uint {
24 // Application received stop command message
25 STOP_REQUESTED,
26
27 // Application received restart command message
28 RESTART_REQUESTED,
29
30 // Application terminated - only occurs when starter is shutting down
31 TERMINATE,
32
33 // System failed to fork and create a new process
34 FORK_ERR,
35
36 // Failed to set parent death handler on child
37 SET_PRCTL_ERR,
38
39 // Failed to change to the requested user
40 SET_USR_ERR,
41
42 // Failed to execute application - likely due to a missing executable or
43 // invalid permissions. This is not reported if an application dies for
44 // another reason after it is already running.
45 EXECV_ERR
46}
47
48table Status {
49 statuses: [ApplicationStatus];
50}
51
52table ApplicationStatus {
53 name: string;
54
55 state: State;
56
57 // Last exit code of the process. Has a value of 0 if not started.
58 last_exit_code: ubyte;
59
60 // Last pid of the process. Could be associated with a different process
61 // unless status == RUNNING. Not present if the process has not started.
62 pid: uint;
63
64 // Unique id of this application and process
65 id: uint64;
66
67 // Start time in nanoseconds relative to monotonic clock
68 last_start_time: int64;
69
70 // Indicates the reason the application is not running. Only valid if
71 // application is STOPPED.
72 last_stop_reason: LastStopReason;
73}
74
75root_type Status;