| include "aos/util/process_info.fbs"; |
| |
| namespace aos.starter; |
| |
| enum State : short { |
| // Process has recently stopped and is waiting to restart. |
| WAITING, |
| |
| // Process has forked, waiting to move to RUNNING after verifying it started |
| // successfully. |
| STARTING, |
| |
| // Process is running. pid, id, and last_start_time represent the current |
| // running process. |
| RUNNING, |
| |
| // Process has been sent SIGTERM to nicely stop and starter is waiting for it |
| // to exit. |
| STOPPING, |
| |
| // Process is stopped and will not automatically restart unless sent a command |
| STOPPED |
| } |
| |
| enum LastStopReason : uint { |
| // Application received stop command message |
| STOP_REQUESTED, |
| |
| // Application received restart command message |
| RESTART_REQUESTED, |
| |
| // Application terminated - only occurs when starter is shutting down |
| TERMINATE, |
| |
| // System failed to fork and create a new process |
| FORK_ERR, |
| |
| // Failed to set parent death handler on child |
| SET_PRCTL_ERR, |
| |
| // Failed to change to the requested user |
| SET_USR_ERR, |
| |
| // Failed to execute application - likely due to a missing executable or |
| // invalid permissions. This is not reported if an application dies for |
| // another reason after it is already running. |
| EXECV_ERR, |
| |
| // Failed to change to the requested group |
| SET_GRP_ERR |
| } |
| |
| table Status { |
| statuses: [ApplicationStatus] (id: 0); |
| } |
| |
| table ApplicationStatus { |
| name: string (id: 0); |
| |
| state: State (id: 1); |
| |
| // Last exit code of the process. Has a value of 0 if not started. |
| last_exit_code: ubyte (id: 2); |
| |
| // Last pid of the process. Could be associated with a different process |
| // unless status == RUNNING. Not present if the process has not started. |
| pid: uint (id: 3); |
| |
| // Unique id of this application and process |
| id: uint64 (id: 4); |
| |
| // Start time in nanoseconds relative to monotonic clock |
| last_start_time: int64 (id: 5); |
| |
| // Indicates the reason the application is not running. Only valid if |
| // application is STOPPED. |
| last_stop_reason: LastStopReason (id: 6); |
| |
| // Debug information providing the approximate CPU usage and memory footprint of the process. |
| // Populated whenever the process is running (i.e., state != STOPPED). While STOPPING could |
| // refer to another process if another process has somehow claimed the application's PID between |
| // actually stopping and the parent process receiving the signal indicating that the application |
| // finished stopping. |
| process_info: util.ProcessInfo (id: 7); |
| } |
| |
| root_type Status; |