The API is defined in the header file sysroot-*-kos/include/component/execution_manager/i_system_control.h from the KasperskyOS SDK.
The API lets you receive information about processes that were started by means of the ExecutionManager component, and it lets you shut down the system.
Information about API functions is provided in the table below.
Receiving information about processes
To request information about processes, call the GetSystemInfo() function. Using the ProcessInfos output parameter, this function returns information about processes as a vector of ProcessInfo structures.
struct ProcessInfo
{
// Process name.
std::string name;
// Process class name.
std::string eiid;
// State of the process.
ProcessState state;
};
The state enumeration is a component of the ProcessInfo structure and describes the state of a process.
enum class ProcessState : uint32_t
{
// Service constant.
None = 0,
// Process created.
Created,
// Process initialized.
Prepared,
// Process started.
Running,
// Process stopped unexpectedly.
Failed,
// Process stopped, but data on the process is available
// to the GetProcessState() function of the IProcessControl interface.
Finished,
// Process terminated and does not exist in the system.
NotExisting,
};
Shutting down the system
To shut down the system, call the StopAllEntities() function. This function does not have any parameters.
i_system_control.h functions
Function |
Information about the function |
|---|---|
|
Purpose Stops all running processes, then terminates the ExecutionManager process, and sends a device shutdown request to the kernel. Parameters N/A Returned values If successful, the function returns |
|
Purpose Receives information about processes that were started by means of the ExecutionManager component. Parameters
Returned values If successful, the function returns |
Usage example:
client.cpp
int main(int argc, const char *argv[])
{
// ...
alm::execution_manager::ProcessInfos infos{};
res = sysCtl->GetSystemInfo(infos);
if (res != kos::Ok)
{
std::cerr << fmt::format("[{}] Failed to get system info. res=0x{:x}\n", selfName, res);
return EXIT_FAILURE;
}
if (sc->StopAllEntities() != kos::Ok)
{
std::cerr << "Cannot stop all processes\n";
return EXIT_FAILURE;
}
// ...
}
Page top