blob: 4b6683385576ee6e975f777986fcfca30fc37949 [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.
Austin Schuh529ac592021-10-14 16:11:13 -070045 EXECV_ERR,
46
47 // Failed to change to the requested group
James Kuszmaul6f10b382022-03-11 22:31:38 -080048 SET_GRP_ERR
Tyler Chatowa79419d2020-08-12 20:12:11 -070049}
50
51table Status {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080052 statuses: [ApplicationStatus] (id: 0);
Tyler Chatowa79419d2020-08-12 20:12:11 -070053}
54
55table ApplicationStatus {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080056 name: string (id: 0);
Tyler Chatowa79419d2020-08-12 20:12:11 -070057
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080058 state: State (id: 1);
Tyler Chatowa79419d2020-08-12 20:12:11 -070059
60 // Last exit code of the process. Has a value of 0 if not started.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080061 last_exit_code: ubyte (id: 2);
Tyler Chatowa79419d2020-08-12 20:12:11 -070062
63 // Last pid of the process. Could be associated with a different process
64 // unless status == RUNNING. Not present if the process has not started.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080065 pid: uint (id: 3);
Tyler Chatowa79419d2020-08-12 20:12:11 -070066
67 // Unique id of this application and process
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080068 id: uint64 (id: 4);
Tyler Chatowa79419d2020-08-12 20:12:11 -070069
70 // Start time in nanoseconds relative to monotonic clock
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080071 last_start_time: int64 (id: 5);
Tyler Chatowa79419d2020-08-12 20:12:11 -070072
73 // Indicates the reason the application is not running. Only valid if
74 // application is STOPPED.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080075 last_stop_reason: LastStopReason (id: 6);
Tyler Chatowa79419d2020-08-12 20:12:11 -070076}
77
78root_type Status;