GATE
C/C++ Framework
Loading...
Searching...
No Matches
os.h File Reference

OS information and control library. More...

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.

Detailed Description

OS information and control library.

Function Documentation

◆ gate_os_get_platform()

GATE_SYSTEM_API gate_result_t gate_os_get_platform ( gate_uint32_t * ptr_platform)

Returns a unique platform ID.

Parameters
[out]ptr_platformPointer to variable that receives the platform ID
Returns
GATE_RESULT_* result code

◆ gate_os_get_platform_label()

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.

Parameters
[in]platformA platform ID to be translated into a string
Returns
GATE_RESULT_* static C-string pointer with a platform name, or NULL for an invalid ID

◆ gate_os_address_space()

GATE_SYSTEM_API gate_uint32_t gate_os_address_space ( )

Returns the address space bits of the platform (e.g. 16, 32, 64 bits)

Returns
Bits of memory address space access

◆ gate_os_up_time_seconds()

GATE_SYSTEM_API gate_uint32_t gate_os_up_time_seconds ( )

Returns the amount of seconds the system is online.

Returns
Online time in seconds

◆ gate_os_print_osname()

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")

Parameters
[in]bufferPointer to buffer to be filled
[in]buffer_lenMaximum capacity of buffer
[out]buffer_usedPointer to variable that receives the amount of filled bytes in the buffer
Returns
GATE_RESULT_* result code

◆ gate_os_print_productname()

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")

Parameters
[in]bufferPointer to buffer to be filled
[in]buffer_lenMaximum capacity of buffer
[out]buffer_usedPointer to variable that receives the amount of filled bytes in the buffer
Returns
GATE_RESULT_* result code

◆ gate_os_get_version()

GATE_SYSTEM_API gate_result_t gate_os_get_version ( gate_version_t * ptr_version)

Retrieves the internal version of the operating system.

Parameters
[out]ptr_versionPointer to version to be filled
Returns
GATE_RESULT_* result code

◆ gate_os_get_hostname_str()

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.

Parameters
[in]bufferPointer to buffer to be filled
[in]buffer_lenMaximum capacity of buffer
[out]buffer_usedPointer to variable that receives the amount of filled bytes in the buffer
Returns
GATE_RESULT_* result code

◆ gate_os_get_hostname()

GATE_SYSTEM_API gate_result_t gate_os_get_hostname ( gate_string_t * hostname)

Returns the system's hostname as a string.

Parameters
[out]hostnamePointer to string to be initialized with the hostname
Returns
GATE_RESULT_* result code

◆ gate_os_set_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.

Parameters
[in]hostnamePointer to string with new hostname
Returns
GATE_RESULT_* result code

◆ gate_os_get_hostdomainname_str()

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.

Parameters
[in]bufferPointer to buffer to be filled
[in]buffer_lenMaximum capacity of buffer
[out]buffer_usedPointer to variable that receives the amount of filled bytes in the buffer
Returns
GATE_RESULT_* result code

◆ gate_os_get_hostdomainname()

GATE_SYSTEM_API gate_result_t gate_os_get_hostdomainname ( gate_string_t * domainname)

Returns the system's domain name as a string.

Parameters
[out]domainnamePointer to string that is initialized with the system's domain name
Returns
GATE_RESULT_* result code

◆ gate_os_set_hostdomainname()

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.

Parameters
[in]domainnamePointer to string with new domain name
Returns
GATE_RESULT_* result code

◆ gate_os_get_uid()

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.

Parameters
[in]bufferPointer to buffer to be filled
[in]buffer_lenMaximum capacity of buffer
[out]buffer_usedPointer to variable that receives the amount of filled bytes in the buffer
Returns
GATE_RESULT_* result code

◆ gate_os_shutdown()

GATE_SYSTEM_API gate_result_t gate_os_shutdown ( )

Initiates a system shutdown.

Returns
GATE_RESULT_* result code

◆ gate_os_reboot()

GATE_SYSTEM_API gate_result_t gate_os_reboot ( )

Initiates a system reboot.

Returns
GATE_RESULT_* result code

◆ gate_os_get_cpu_architecture()

GATE_SYSTEM_API gate_result_t gate_os_get_cpu_architecture ( gate_enumint_t * ptr_arch)

Returns the running CPU architecture type.

Parameters
[out]ptr_archPointer to variable that receives a GATE_OS_ARCH_* identifier
Returns
GATE_RESULT_* result code

◆ gate_os_get_cpu_architecture_label()

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.

Parameters
[in]archGATE_OS_ARCH_* identifier
Returns
static character string representing the CPU archictecture label

◆ gate_os_get_cpu_info()

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.

Parameters
[out]infoPointer to variable that receives CPU data
Returns
GATE_RESULT_* result code

◆ gate_os_enum_cpu_features()

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.

Parameters
[in]callbackCallback function
[in]paramUser parameter added to the callback function call
Returns
GATE_RESULT_* result code

◆ gate_os_cpu_get_activation()

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.

Parameters
[in]activationPointer to structure with activated CPU cores
[in]idCPU core to query
Returns
true if CPU core is activated, false if deactivated

◆ gate_os_cpu_set_activation()

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.

Parameters
[in]activationPointer to activation structure
[in]idCPU core to be modified
[out]activatedtrue enables the CPU core, false disables it
Returns
GATE_RESULT_* result code

◆ gate_os_get_process_cpu_affinity()

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.

Parameters
[out]affinityPointer to CPU activation structure to be filled
Returns
GATE_RESULT_* result code

◆ gate_os_set_process_cpu_affinity()

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.

Parameters
[in]affinityPointer to CPU activation structure to be applied
Returns
GATE_RESULT_* result code

◆ gate_os_cpu_load_init()

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.

Parameters
[out]statePointer to cpu-load record
Returns
GATE_RESULT_* result code

◆ gate_os_cpu_load_update()

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.

Parameters
[in]bufferPointer to cpu-load record
[out]load65535Pointer to 16-bit value indicating the CPU load between 0 (no load) and 65535 (full load)
Returns
GATE_RESULT_* result code

◆ gate_os_cpu_load_uninit()

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.

Parameters
[in]statePointer to cpu-load record
Returns
GATE_RESULT_* result code

◆ gate_os_get_physical_memory()

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.

Parameters
[out]ptr_totalPointer to variable to be set to total installed memory in bytes
[out]ptr_availablePointer to variable to be set to available (free) memory in bytes
Returns
GATE_RESULT_* result code

◆ gate_os_get_virtual_memory()

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.

Parameters
[out]ptr_totalPointer to variable to be set to total virtual memory in bytes
[out]ptr_availablePointer to variable to be set to available (free) virtual memory in bytes
Returns
GATE_RESULT_* result code