LiteIPC

Basic Concepts

LiteIPC is a new inter-process communication (IPC) mechanism provided by the OpenHarmony LiteOS-A kernel. Different from the traditional System V IPC, LiteIPC is designed for Remote Procedure Call (RPC). In addition, it provides APIs for the upper layer through device files, not through traditional API functions.

LiteIPC has two important concepts: ServiceManager and Service. The entire system can have one ServiceManager and multiple Services. ServiceManager is responsible for registering and unregistering services, and managing Service access permission (only authorized tasks can send IPC messages to corresponding Services).

Working Principles

ServiceManager registers the task that needs to receive IPC messages as a Service, and sets the access permission for the Service task (specifies the tasks that can send IPC messages to the Service). LiteIPC maintains an IPC message queue for each Service task in kernel space. The message queue provides the upper-layer user-space programs with the read operation (receiving IPC messages) and the write operations (sending IPC messages) through LiteIPC device files.

Development Guidelines

Available APIs

Table 1 LiteIPC module APIs (for LiteOS-A internal use only)

Category

API

Description

Module initialization

OsLiteIpcInit

Initializes the LiteIPC module.

IPC message memory pool

LiteIpcPoolInit

Initializes the IPC message memory pool of processes.

LiteIpcPoolReInit

Re-initializes the IPC message memory pool of processes.

LiteIpcPoolDelete

Releases the IPC message memory pool of processes.

Service management

LiteIpcRemoveServiceHandle

Deletes the specified Service.

NOTE: LiteIPC module APIs are used for LiteOS-A internal use only.