Starting processes using the system program ExecutionManager
The ExecutionManager component provides a C++ interface for creating, starting and stopping processes in solutions that are based on KasperskyOS.
The interface of the ExecutionManager component is not suitable for use in code that is written in C. To manage processes in the C language, use the task.h interface of the libkos library.
The ExecutionManager component API is an add-on over IPC that helps simplify the program development process. ExecutionManager is a separate system program that is accessed through IPC. However, developers are provided with a client library that eliminates the necessity of directly using IPC calls.
The programming interface of the ExecutionManager component is described in the article titled "ExecutionManager component".
ExecutionManager component usage scenario
Hereinafter "the client" refers to the application that uses the ExecutionManager component API to manage other applications.
The typical usage scenario for the ExecutionManager component includes the following steps:
- Add the ExecutionManager program to a solution. To add ExecutionManager to a solution:
- Add the following commands to the CMakeLists.txt root file:
find_package (execution_manager REQUIRED) include_directories (${execution_manager_INCLUDE}) add_subdirectory (execution_manager)The
BlobContainer
program is required for the ExecutionManager program to work properly. This program is automatically added to a solution when adding ExecutionManager.- The ExecutionManager component is provided in the SDK as a set of static libraries and header files, and is built for a specific solution by using the CMake command
create_execution_manager_entity()
from the CMake libraryexecution_manager
.To build the ExecutionManager program, create a directory named
execution_manager
in the root directory of the project. In the new directory, create aCMakeLists.txt
file containing thecreate_execution_manager_entity()
command.The CMake command
create_execution_manager_entity()
takes the following parameters:Mandatory
ENTITY
parameter that specifies the name of the executable file for the ExecutionManager program.Optional parameters:
DEPENDS
– additional dependencies for building the ExecutionManager program.MAIN_CONN_NAME
– name of the IPC channel for connecting to the ExecutionManager process. It must match the value of themainConnection
variable when calling the ExecutionManager API in the client code.ROOT_PATH
– path to the root directory for service files of the ExecutionManager program. The default root path is"/ROOT"
.VFS_CLIENT_LIB
– name of the client transport library used to connect the ExecutionManager program to theVFS
program.
include (execution_manager/create_execution_manager_entity) create_execution_manager_entity( ENTITY ExecMgrEntity MAIN_CONN_NAME ${ENTITY_NAME} ROOT_PATH "/root" VFS_CLIENT_LIB ${vfs_CLIENT_LIB})- When building a solution (CMakeLists.txt file for the Einit program), add the following executable files to the solution image:
- Executable file of the ExecutionManager program
- Executable file of the
BlobContainer
program
- Link the client executable file to the client proxy library of ExecutionManager by adding the following command to the
CMakeLists.txt
file for building the client:target_link_libraries (<name of the CMake target for building the client> ${execution_manager_EXECMGR_PROXY}) - Add permissions for the necessary events to the solution security policy description:
- To enable the ExecutionManager program to run other processes, the solution security policy must allow the following interactions for the
execution_manager.ExecMgrEntity
process class:- Security events of the
execute
type for all classes of processes that will be run. - Access to all endpoints of the
VFS
program. - Access to all endpoints of the
BlobContainer
program. - Access to the core endpoints
Sync
,Task
,VMM
,Thread
,HAL
,Handle
,FS
,Notice
,CM
andProfiler
(their descriptions are located in the directorysysroot-*-kos/include/kl/core
from the SDK).
- Security events of the
- To enable a client to call the ExecutionManager program, the solution security policy must allow the following interactions for the client process class:
- Access to the appropriate endpoints of the ExecutionManager program (their descriptions are located in the directory
sysroot-*-kos/include/kl/execution_manager
from the SDK).
- Access to the appropriate endpoints of the ExecutionManager program (their descriptions are located in the directory
- To enable the ExecutionManager program to run other processes, the solution security policy must allow the following interactions for the
- Use of the ExecutionManager program API in the client code.
Use the header file
component/package_manager/kos_ipc/package_manager_proxy.h
for this. For more details, refer to "ExecutionManager component".