blob: 8c7cdaeef863f6d6e63dd03a3701a2d5888ffee9 [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 {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080049 statuses: [ApplicationStatus] (id: 0);
Tyler Chatowa79419d2020-08-12 20:12:11 -070050}
51
52table ApplicationStatus {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080053 name: string (id: 0);
Tyler Chatowa79419d2020-08-12 20:12:11 -070054
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080055 state: State (id: 1);
Tyler Chatowa79419d2020-08-12 20:12:11 -070056
57 // Last exit code of the process. Has a value of 0 if not started.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080058 last_exit_code: ubyte (id: 2);
Tyler Chatowa79419d2020-08-12 20:12:11 -070059
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.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080062 pid: uint (id: 3);
Tyler Chatowa79419d2020-08-12 20:12:11 -070063
64 // Unique id of this application and process
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080065 id: uint64 (id: 4);
Tyler Chatowa79419d2020-08-12 20:12:11 -070066
67 // Start time in nanoseconds relative to monotonic clock
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080068 last_start_time: int64 (id: 5);
Tyler Chatowa79419d2020-08-12 20:12:11 -070069
70 // Indicates the reason the application is not running. Only valid if
71 // application is STOPPED.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080072 last_stop_reason: LastStopReason (id: 6);
Tyler Chatowa79419d2020-08-12 20:12:11 -070073}
74
75root_type Status;