blob: 728528134fea4938d7adf6ca169fdb7c73b279b2 [file] [log] [blame]
James Kuszmaul6295a642022-03-22 15:23:59 -07001include "aos/util/process_info.fbs";
2
Tyler Chatowa79419d2020-08-12 20:12:11 -07003namespace aos.starter;
4
5enum State : short {
6 // Process has recently stopped and is waiting to restart.
7 WAITING,
8
9 // Process has forked, waiting to move to RUNNING after verifying it started
10 // successfully.
11 STARTING,
12
13 // Process is running. pid, id, and last_start_time represent the current
14 // running process.
15 RUNNING,
16
17 // Process has been sent SIGTERM to nicely stop and starter is waiting for it
18 // to exit.
19 STOPPING,
20
21 // Process is stopped and will not automatically restart unless sent a command
22 STOPPED
23}
24
25enum LastStopReason : uint {
26 // Application received stop command message
27 STOP_REQUESTED,
28
29 // Application received restart command message
30 RESTART_REQUESTED,
31
32 // Application terminated - only occurs when starter is shutting down
33 TERMINATE,
34
35 // System failed to fork and create a new process
36 FORK_ERR,
37
38 // Failed to set parent death handler on child
39 SET_PRCTL_ERR,
40
41 // Failed to change to the requested user
42 SET_USR_ERR,
43
44 // Failed to execute application - likely due to a missing executable or
45 // invalid permissions. This is not reported if an application dies for
46 // another reason after it is already running.
Austin Schuh529ac592021-10-14 16:11:13 -070047 EXECV_ERR,
48
49 // Failed to change to the requested group
James Kuszmaul6f10b382022-03-11 22:31:38 -080050 SET_GRP_ERR
Tyler Chatowa79419d2020-08-12 20:12:11 -070051}
52
53table Status {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080054 statuses: [ApplicationStatus] (id: 0);
Tyler Chatowa79419d2020-08-12 20:12:11 -070055}
56
57table ApplicationStatus {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080058 name: string (id: 0);
Tyler Chatowa79419d2020-08-12 20:12:11 -070059
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080060 state: State (id: 1);
Tyler Chatowa79419d2020-08-12 20:12:11 -070061
62 // Last exit code of the process. Has a value of 0 if not started.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080063 last_exit_code: ubyte (id: 2);
Tyler Chatowa79419d2020-08-12 20:12:11 -070064
65 // Last pid of the process. Could be associated with a different process
66 // unless status == RUNNING. Not present if the process has not started.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080067 pid: uint (id: 3);
Tyler Chatowa79419d2020-08-12 20:12:11 -070068
69 // Unique id of this application and process
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080070 id: uint64 (id: 4);
Tyler Chatowa79419d2020-08-12 20:12:11 -070071
72 // Start time in nanoseconds relative to monotonic clock
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080073 last_start_time: int64 (id: 5);
Tyler Chatowa79419d2020-08-12 20:12:11 -070074
75 // Indicates the reason the application is not running. Only valid if
76 // application is STOPPED.
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080077 last_stop_reason: LastStopReason (id: 6);
James Kuszmaul6295a642022-03-22 15:23:59 -070078
79 // Debug information providing the approximate CPU usage and memory footprint of the process.
80 // Populated whenever the process is running (i.e., state != STOPPED). While STOPPING could
81 // refer to another process if another process has somehow claimed the application's PID between
82 // actually stopping and the parent process receiving the signal indicating that the application
83 // finished stopping.
84 process_info: util.ProcessInfo (id: 7);
Tyler Chatowa79419d2020-08-12 20:12:11 -070085}
86
87root_type Status;