System methods for reading information about the environment. More...
![]() |
Typedefs | |
typedef void(* | sys_env_signal_callback_t) (sys_env_signal_t signal) |
Callback function type for handling environment signals. More... | |
Enumerations | |
enum | sys_env_signal_t { SYS_ENV_SIGNAL_NONE = 0, SYS_ENV_SIGNAL_TERM, SYS_ENV_SIGNAL_INT, SYS_ENV_SIGNAL_QUIT = (1 << 2) } |
Environment signal types. More... | |
Functions | |
bool | sys_env_signalhandler (sys_env_signal_t mask, sys_env_signal_callback_t callback) |
Sets a handler for environment signals. More... | |
const char * | sys_env_serial (void) |
Returns a unique identifier for the current environment. More... | |
const char * | sys_env_name (void) |
Returns the name of the current environment. More... | |
const char * | sys_env_version (void) |
Returns the version of the current environment. More... | |
System methods for reading information about the environment.
typedef void(* sys_env_signal_callback_t) (sys_env_signal_t signal) |
Callback function type for handling environment signals.
signal | The type of signal that was received. |
This typedef defines the signature for callback functions that handle environment signals. The callback receives a signal type parameter indicating which signal was received.
enum sys_env_signal_t |
Environment signal types.
Enumeration of signal types that can be received from the environment or operating system. These signals typically indicate termination or interrupt requests that applications should handle gracefully.
Definition at line 24 of file env.h.
const char* sys_env_name | ( | void | ) |
Returns the name of the current environment.
const char* sys_env_serial | ( | void | ) |
Returns a unique identifier for the current environment.
bool sys_env_signalhandler | ( | sys_env_signal_t | mask, |
sys_env_signal_callback_t | callback | ||
) |
Sets a handler for environment signals.
mask | Bitmask of sys_env_signal_t values indicating which signals to handle. If zero, all signals are handled. |
callback | The callback function to handle signals, or NULL to disable signal handling. |
This function registers a callback function that will be invoked when the application receives environment signals such as termination requests (SIGTERM), interrupt signals (SIGINT), or quit signals (SIGQUIT). The callback allows applications to perform graceful shutdown procedures when requested.
Only one signal handler can be active at a time. Setting a new handler will replace any previously registered handler.
Not all platforms support all signal types. Embedded platforms may have limited or no signal support.
The signal handler may be called from interrupt context on some platforms. Keep the implementation simple and avoid blocking operations, memory allocation, or complex system calls within the callback.
const char* sys_env_version | ( | void | ) |
Returns the version of the current environment.