Overview of the libkos library
The KasperskyOS kernel has a number of endpoints for managing handles, threads, memory, processes, IPC channels, I/O resources, and others. The libkos library is used for accessing endpoints.
libkos library
The libkos library consists of two parts:
- The first part provides the C interface for accessing KasperskyOS core endpoints. It is available through the header files in the
coresrvdirectory. - The second part of the
libkoslibrary provides abstractions of synchronization primitives, objects, and queues. It also contains wrapper functions for simpler memory allocation and thread management. Header files of the second part oflibkosare in thekosdirectory.
The libkos library significantly simplifies the use of core endpoints. The libkos library functions ensure correct packaging of an IPC message and execution of system calls. Other libraries (including libc) interact with the kernel through the libkos library.
To use a KasperskyOS core endpoint, you need to include the libkos library header file corresponding to this endpoint. For example, to access methods of the IO Manager, you need to include the io_api.h file:
#include <coresrv/io/io_api.h>
Files used by the libkos library
An intrinsic implementation of the libkos library can use the following files exported by the kernel:
- Files in the IDL language (IDL descriptions). They contain descriptions of the interfaces of endpoints. They are used by IPC transport for correct packaging of messages.
- Header files of the kernel. These files are included in the
libkoslibrary.
Example
The I/O Manager is provided for the user in the following files:
coresrv/io/io_api.his a header file of thelibkoslibrary.services/io/IO.idlis the IDL description of the I/O manager.io/io_dma.handio/io_irq.hare header files of the kernel.