GATE
C/C++ Framework
|
OS information and control library. More...
#include "gate/system/gate_system_api.h"
#include "gate/gatetypes.h"
#include "gate/strings.h"
#include "gate/versioning.h"
Functions | |
GATE_SYSTEM_API gate_result_t | gate_os_get_platform (gate_uint32_t *ptr_platform) |
Returns a unique platform ID. | |
GATE_SYSTEM_API char const * | gate_os_get_platform_label (gate_uint32_t platform) |
Returns a human readable string representing for the given platform ID. | |
GATE_SYSTEM_API gate_uint32_t | gate_os_address_space () |
Returns the address space bits of the platform (e.g. 16, 32, 64 bits) | |
GATE_SYSTEM_API gate_uint32_t | gate_os_up_time_seconds () |
Returns the amount of seconds the system is online. | |
GATE_SYSTEM_API gate_result_t | gate_os_print_osname (char *buffer, gate_size_t buffer_len, gate_size_t *buffer_used) |
Prints the operating system's name into a buffer (e.g. "Windows NT", "Linux") | |
GATE_SYSTEM_API gate_result_t | gate_os_print_productname (char *buffer, gate_size_t buffer_len, gate_size_t *buffer_used) |
Prints the operating system's product name into a buffer (e.g. "Windows 10", "Debian Linux") | |
GATE_SYSTEM_API gate_result_t | gate_os_get_version (gate_version_t *ptr_version) |
Retrieves the internal version of the operating system. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_hostname_str (char *buffer, gate_size_t buffer_len, gate_size_t *buffer_used) |
Prints the system's hostname into a buffer. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_hostname (gate_string_t *hostname) |
Returns the system's hostname as a string. | |
GATE_SYSTEM_API gate_result_t | gate_os_set_hostname (gate_string_t const *hostname) |
Sets a new value to the system's hostname. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_hostdomainname_str (char *buffer, gate_size_t buffer_len, gate_size_t *buffer_used) |
Prints the current system's domain name into a buffer. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_hostdomainname (gate_string_t *domainname) |
Returns the system's domain name as a string. | |
GATE_SYSTEM_API gate_result_t | gate_os_set_hostdomainname (gate_string_t const *domainname) |
Sets a new value for the system's domain name. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_uid (gate_uint8_t *buffer, gate_size_t buffer_len, gate_size_t *buffer_used) |
Prints the user ID the current process is running as into a buffer. | |
GATE_SYSTEM_API gate_result_t | gate_os_shutdown () |
Initiates a system shutdown. | |
GATE_SYSTEM_API gate_result_t | gate_os_reboot () |
Initiates a system reboot. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_cpu_architecture (gate_enumint_t *ptr_arch) |
Returns the running CPU architecture type. | |
GATE_SYSTEM_API char const * | gate_os_get_cpu_architecture_label (gate_enumint_t arch) |
Returns a readable string for the given CPU architecture identifier. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_cpu_info (gate_os_cpuinfo_t *info) |
Fills a CPU info structure with data about the operating CPU. | |
GATE_SYSTEM_API gate_result_t | gate_os_enum_cpu_features (gate_os_cpu_feature_callback_t callback, void *param) |
Enumerates all CPU features and calls a callback function for each detected feature. | |
GATE_SYSTEM_API gate_bool_t | gate_os_cpu_get_activation (gate_os_cpu_activation_t const *activation, gate_size_t id) |
Returns true if a CPU identified by an ID is activated for running tasks. | |
GATE_SYSTEM_API gate_result_t | gate_os_cpu_set_activation (gate_os_cpu_activation_t *activation, gate_size_t id, gate_bool_t activated) |
Sets on CPU activation bit. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_process_cpu_affinity (gate_os_cpu_activation_t *affinity) |
Returns current process CPU afinity activation data. | |
GATE_SYSTEM_API gate_result_t | gate_os_set_process_cpu_affinity (gate_os_cpu_activation_t const *affinity) |
Changes the current process CPU afinitiy activation data. | |
GATE_SYSTEM_API gate_result_t | gate_os_cpu_load_init (gate_os_cpu_load_state_t *state) |
Initializes the CPU load state record structure. | |
GATE_SYSTEM_API gate_result_t | gate_os_cpu_load_update (gate_os_cpu_load_state_t *state, gate_uint16_t *load65535) |
Updates the CPU load state record and returns the current calculated CPU load. | |
GATE_SYSTEM_API gate_result_t | gate_os_cpu_load_uninit (gate_os_cpu_load_state_t *state) |
Releases resources from the CPU load state record structure. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_physical_memory (gate_uint64_t *ptr_total, gate_uint64_t *ptr_available) |
Returns current global physical system memory status. | |
GATE_SYSTEM_API gate_result_t | gate_os_get_virtual_memory (gate_uint64_t *ptr_total, gate_uint64_t *ptr_available) |
Returns current global virtual system memory status. |
OS information and control library.
GATE_SYSTEM_API gate_result_t gate_os_get_platform | ( | gate_uint32_t * | ptr_platform | ) |
Returns a unique platform ID.
[out] | ptr_platform | Pointer to variable that receives the platform ID |
GATE_SYSTEM_API char const * gate_os_get_platform_label | ( | gate_uint32_t | platform | ) |
Returns a human readable string representing for the given platform ID.
[in] | platform | A platform ID to be translated into a string |
GATE_SYSTEM_API gate_uint32_t gate_os_address_space | ( | ) |
Returns the address space bits of the platform (e.g. 16, 32, 64 bits)
GATE_SYSTEM_API gate_uint32_t gate_os_up_time_seconds | ( | ) |
Returns the amount of seconds the system is online.
GATE_SYSTEM_API gate_result_t gate_os_print_osname | ( | char * | buffer, |
gate_size_t | buffer_len, | ||
gate_size_t * | buffer_used ) |
Prints the operating system's name into a buffer (e.g. "Windows NT", "Linux")
[in] | buffer | Pointer to buffer to be filled |
[in] | buffer_len | Maximum capacity of buffer |
[out] | buffer_used | Pointer to variable that receives the amount of filled bytes in the buffer |
GATE_SYSTEM_API gate_result_t gate_os_print_productname | ( | char * | buffer, |
gate_size_t | buffer_len, | ||
gate_size_t * | buffer_used ) |
Prints the operating system's product name into a buffer (e.g. "Windows 10", "Debian Linux")
[in] | buffer | Pointer to buffer to be filled |
[in] | buffer_len | Maximum capacity of buffer |
[out] | buffer_used | Pointer to variable that receives the amount of filled bytes in the buffer |
GATE_SYSTEM_API gate_result_t gate_os_get_version | ( | gate_version_t * | ptr_version | ) |
Retrieves the internal version of the operating system.
[out] | ptr_version | Pointer to version to be filled |
GATE_SYSTEM_API gate_result_t gate_os_get_hostname_str | ( | char * | buffer, |
gate_size_t | buffer_len, | ||
gate_size_t * | buffer_used ) |
Prints the system's hostname into a buffer.
[in] | buffer | Pointer to buffer to be filled |
[in] | buffer_len | Maximum capacity of buffer |
[out] | buffer_used | Pointer to variable that receives the amount of filled bytes in the buffer |
GATE_SYSTEM_API gate_result_t gate_os_get_hostname | ( | gate_string_t * | hostname | ) |
Returns the system's hostname as a string.
[out] | hostname | Pointer to string to be initialized with the hostname |
GATE_SYSTEM_API gate_result_t gate_os_set_hostname | ( | gate_string_t const * | hostname | ) |
Sets a new value to the system's hostname.
[in] | hostname | Pointer to string with new hostname |
GATE_SYSTEM_API gate_result_t gate_os_get_hostdomainname_str | ( | char * | buffer, |
gate_size_t | buffer_len, | ||
gate_size_t * | buffer_used ) |
Prints the current system's domain name into a buffer.
[in] | buffer | Pointer to buffer to be filled |
[in] | buffer_len | Maximum capacity of buffer |
[out] | buffer_used | Pointer to variable that receives the amount of filled bytes in the buffer |
GATE_SYSTEM_API gate_result_t gate_os_get_hostdomainname | ( | gate_string_t * | domainname | ) |
Returns the system's domain name as a string.
[out] | domainname | Pointer to string that is initialized with the system's domain name |
GATE_SYSTEM_API gate_result_t gate_os_set_hostdomainname | ( | gate_string_t const * | domainname | ) |
Sets a new value for the system's domain name.
[in] | domainname | Pointer to string with new domain name |
GATE_SYSTEM_API gate_result_t gate_os_get_uid | ( | gate_uint8_t * | buffer, |
gate_size_t | buffer_len, | ||
gate_size_t * | buffer_used ) |
Prints the user ID the current process is running as into a buffer.
[in] | buffer | Pointer to buffer to be filled |
[in] | buffer_len | Maximum capacity of buffer |
[out] | buffer_used | Pointer to variable that receives the amount of filled bytes in the buffer |
GATE_SYSTEM_API gate_result_t gate_os_shutdown | ( | ) |
Initiates a system shutdown.
GATE_SYSTEM_API gate_result_t gate_os_reboot | ( | ) |
Initiates a system reboot.
GATE_SYSTEM_API gate_result_t gate_os_get_cpu_architecture | ( | gate_enumint_t * | ptr_arch | ) |
Returns the running CPU architecture type.
[out] | ptr_arch | Pointer to variable that receives a GATE_OS_ARCH_* identifier |
GATE_SYSTEM_API char const * gate_os_get_cpu_architecture_label | ( | gate_enumint_t | arch | ) |
Returns a readable string for the given CPU architecture identifier.
[in] | arch | GATE_OS_ARCH_* identifier |
GATE_SYSTEM_API gate_result_t gate_os_get_cpu_info | ( | gate_os_cpuinfo_t * | info | ) |
Fills a CPU info structure with data about the operating CPU.
[out] | info | Pointer to variable that receives CPU data |
GATE_SYSTEM_API gate_result_t gate_os_enum_cpu_features | ( | gate_os_cpu_feature_callback_t | callback, |
void * | param ) |
Enumerates all CPU features and calls a callback function for each detected feature.
[in] | callback | Callback function |
[in] | param | User parameter added to the callback function call |
GATE_SYSTEM_API gate_bool_t gate_os_cpu_get_activation | ( | gate_os_cpu_activation_t const * | activation, |
gate_size_t | id ) |
Returns true if a CPU identified by an ID is activated for running tasks.
[in] | activation | Pointer to structure with activated CPU cores |
[in] | id | CPU core to query |
GATE_SYSTEM_API gate_result_t gate_os_cpu_set_activation | ( | gate_os_cpu_activation_t * | activation, |
gate_size_t | id, | ||
gate_bool_t | activated ) |
Sets on CPU activation bit.
[in] | activation | Pointer to activation structure |
[in] | id | CPU core to be modified |
[out] | activated | true enables the CPU core, false disables it |
GATE_SYSTEM_API gate_result_t gate_os_get_process_cpu_affinity | ( | gate_os_cpu_activation_t * | affinity | ) |
Returns current process CPU afinity activation data.
[out] | affinity | Pointer to CPU activation structure to be filled |
GATE_SYSTEM_API gate_result_t gate_os_set_process_cpu_affinity | ( | gate_os_cpu_activation_t const * | affinity | ) |
Changes the current process CPU afinitiy activation data.
[in] | affinity | Pointer to CPU activation structure to be applied |
GATE_SYSTEM_API gate_result_t gate_os_cpu_load_init | ( | gate_os_cpu_load_state_t * | state | ) |
Initializes the CPU load state record structure.
[out] | state | Pointer to cpu-load record |
GATE_SYSTEM_API gate_result_t gate_os_cpu_load_update | ( | gate_os_cpu_load_state_t * | state, |
gate_uint16_t * | load65535 ) |
Updates the CPU load state record and returns the current calculated CPU load.
[in] | buffer | Pointer to cpu-load record |
[out] | load65535 | Pointer to 16-bit value indicating the CPU load between 0 (no load) and 65535 (full load) |
GATE_SYSTEM_API gate_result_t gate_os_cpu_load_uninit | ( | gate_os_cpu_load_state_t * | state | ) |
Releases resources from the CPU load state record structure.
[in] | state | Pointer to cpu-load record |
GATE_SYSTEM_API gate_result_t gate_os_get_physical_memory | ( | gate_uint64_t * | ptr_total, |
gate_uint64_t * | ptr_available ) |
Returns current global physical system memory status.
[out] | ptr_total | Pointer to variable to be set to total installed memory in bytes |
[out] | ptr_available | Pointer to variable to be set to available (free) memory in bytes |
GATE_SYSTEM_API gate_result_t gate_os_get_virtual_memory | ( | gate_uint64_t * | ptr_total, |
gate_uint64_t * | ptr_available ) |
Returns current global virtual system memory status.
[out] | ptr_total | Pointer to variable to be set to total virtual memory in bytes |
[out] | ptr_available | Pointer to variable to be set to available (free) virtual memory in bytes |