Rishka
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
|
Class for handling system utilities in Rishka applications. More...
#include <sys.h>
Static Public Member Functions | |
static void | delay (u64 ms) |
Delay execution for a specified duration. More... | |
static u64 | micros () |
Get the current system time in microseconds. More... | |
static u64 | millis () |
Get the current system time in milliseconds. More... | |
static i64 | shellexec (string cmdline) |
Execute a shell command. More... | |
static void | exit (i32 code) |
Terminate the application with an exit code. More... | |
static string | info_str (sysinfos_t key) |
Get system information as a string. More... | |
static i64 | info_num (sysinfon_t key) |
Get system information as a numeric value. More... | |
static i64 | random () |
Generate a random integer value. More... | |
static bool | change_dir (char *directory) |
Changes the current working directory. More... | |
static string | working_dir () |
Retrieves the current working directory. More... | |
Class for handling system utilities in Rishka applications.
The Sys class provides static methods for delaying execution, accessing system time, executing shell commands, retrieving system information, and exiting the application.
|
static |
Changes the current working directory.
This static method changes the current working directory to the specified directory.
directory | The directory to change to. |
|
static |
Delay execution for a specified duration.
This method suspends program execution for the specified number of milliseconds.
ms | The duration to delay in milliseconds. |
|
static |
Terminate the application with an exit code.
This method terminates the application with the specified exit code.
code | The exit code for the application. |
|
static |
Get system information as a numeric value.
This method retrieves system information specified by the key as a numeric value.
key | The key for the system information. |
|
static |
Get system information as a string.
This method retrieves system information specified by the key as a string representation.
key | The key for the system information. |
|
static |
Get the current system time in microseconds.
This method returns the current system time in microseconds since boot.
|
static |
Get the current system time in milliseconds.
This method returns the current system time in milliseconds since boot.
|
static |
Generate a random integer value.
The random() function generates a random integer value within the range supported by the underlying hardware's random number generator. The generated random value is suitable for various applications such as cryptographic operations, simulation, and randomization tasks.
Execute a shell command.
This method executes a shell command with the specified binary program file name, argument count, and argument array.
program | The file name of the binary program to execute. |
argc | The number of arguments in the argument array. |
argv | The array of arguments for the shell command. |
|
static |
Retrieves the current working directory.
This static method returns the current working directory as a string.