Overview of the libkos library

August 2, 2023

ID libkos_intro

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 coresrv directory.
  • The second part of the libkos library 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 of libkos are in the kos directory.

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 libkos library.

Example

The I/O Manager is provided for the user in the following files:

  • coresrv/io/io_api.h is a header file of the libkos library.
  • services/io/IO.idl is the IDL description of the I/O manager.
  • io/io_dma.h and io/io_irq.h are header files of the kernel.

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.