The ExecutionManager component provides interfaces for managing the lifecycle of processes through IPC mechanisms and lets you do the following:
The ExecutionManager component usage scenario and description are provided in Starting processes using the system program ExecutionManager.
The ExecutionManager component's API is defined in the header files located in the directory sysroot-*-kos/include/component/execution_manager/ from the KasperskyOS Community Edition.
execution_manager_proxy.h interface
The API is defined in the header file sysroot-*-kos/include/component/execution_manager/kos_ipc/execution_manager_proxy.h from the KasperskyOS Community Edition.
The interface contains functions for getting the pointer to the instance of the IExecutionManager interface that is required for working with the ExecutionManager component.
Information about API functions is provided in the table below.
The API provides the following two ways to obtain a pointer to the IExecutionManager interface by connecting to the ExecutionManager process using static methods of the ExecutionManagerConnector object:
StaticConnect() function.DcmConnect() function. This method uses the DCM system program.Using the cfg input parameter, the CreateExecutionManager() function accepts configuration parameters in the ExecutionManagerConfig structure. All fields of this structure are optional.
struct ExecutionManagerConfig
{
// Name of the IPC channel for connecting to the ExecutionManager process
char const* const mainConnection = KOS_EXECMGR_CONN_MAIN;
// Name of the endpoint that implements the IApplicationController interface
char const* const appControlInterface = KOS_EXECMGR_IFACE_AC;
// Name of the endpoint that implements the IStateProvider interface
char const* const appStateInterface = KOS_EXECMGR_IFACE_AS;
// Name of the endpoint that implements the ISystemController interface
char const* const systemControlInterface = KOS_EXECMGR_IFACE_SC;
// Name of the endpoint that implements the IProcessControl interface
char const* const processControlInterface = KOS_EXECMGR_IFACE_PC;
// ExecutionManager process class name
char const* const execmgrServerName = KOS_EXECMGR_SERVER_NAME;
};
execution_manager_proxy.h functions
Function |
Information about the function |
|---|---|
|
Purpose Gets the pointer to an instance of the Parameters
Returned values Pointer to the instance of the |
|
Purpose Gets the pointer to an instance of the Parameters
Returned values Pointer to the instance of the |
|
Purpose Gets the pointer to the instance of the Obsolete function; you are advised to use other functions from this table. Parameters
Returned values If successful, the function returns |
Usage example:
client.cpp
#include <component/execution_manager/kos_ipc/execution_manager_proxy.h>
int main(int argc, const char *argv[])
{
// ...
execmgr::IExecutionManagerPtr ptr = execution_manager::ipc::ExecutionManagerConnector::DcmConnect();
// ...
}
IExecutionManager interface
The API is defined in the header file sysroot-*-kos/include/component/execution_manager/i_execution_manager.h from the KasperskyOS Community Edition.
The IExecutionManager interface lets you access pointers to the following interfaces:
IProcessControl – interface that lets you start a process from an executable file installed by the PackageManager component from the KPA package in a KasperskyOS-based solution, and lets you receive information about the process (including information about its completion) and stop this process.IApplicationController – interface that lets you start a process from any executable file whose location in the file system is known, and lets you stop this process.IStateProvider – interface for receiving information about a process that was started using the IApplicationController interface.ISystemController – interface for receiving information about processes that were started by using the ExecutionManager component, and for shutting down the system.Usage example:
client.cpp
int main(int argc, const char *argv[])
{
// ...
alm::execution_manager::IProcessControlPtr pc;
res = emPtr->GetProcessController(pc);
if (res != kos::Ok)
{
std::cerr << fmt::format("[{}] Failed to create process controller. res=0x{:x}\n", selfName, res);
return EXIT_FAILURE;
}
execmgr::IApplicationControllerPtr ac;
if (ptr->GetApplicationController(ac) != kos::Ok)
{
std::cerr << "Cannot get application controller" << std::endl;
return EXIT_FAILURE;
}
execmgr::ISystemControllerPtr sc;
if (ptr->GetSystemController(sc) != kos::Ok)
{
std::cerr << "Cannot get system controller" << std::endl;
return EXIT_FAILURE;
}
// ...
}
Page top