Skip to main content

strat9_kernel/ipc/
mod.rs

1//! Inter-Process Communication (IPC) subsystem.
2//!
3//! Strat9-OS uses two complementary IPC mechanisms:
4//!
5//! ## 1. IPC Ports (synchronous message-passing, service endpoints)
6//!
7//! Each port has a bounded FIFO queue of 64-byte [`IpcMessage`]s.
8//! Senders block when the queue is full; receivers block when empty.
9//! Ports are owned by a single task and accessed via syscalls:
10//! - `SYS_IPC_CREATE_PORT` (200) : create a new port
11//! - `SYS_IPC_SEND` (201) : send a message to a port
12//! - `SYS_IPC_RECV` (202) : receive a message from a port
13//! - `SYS_IPC_CALL` (203) : send and wait for reply
14//! - `SYS_IPC_REPLY` (204) : reply to an IPC call
15//! - `SYS_IPC_BIND_PORT` (205) : bind a port to the namespace
16//! - `SYS_IPC_UNBIND_PORT` (206) : unbind a port
17//!
18//! ## 2. Typed MPMC sync-channels (IPC-02)
19//!
20//! [`channel::channel`]`<T>(capacity)` creates a typed
21//! Multi-Producer/Multi-Consumer channel for kernel-internal use.
22//! [`channel::SyncChan`] provides a symmetric [`IpcMessage`] channel
23//! exposed to userspace silos via:
24//! - `SYS_CHAN_CREATE` (220) : create a channel
25//! - `SYS_CHAN_SEND`   (221) : send (blocking)
26//! - `SYS_CHAN_RECV`   (222) : receive (blocking)
27//! - `SYS_CHAN_TRY_RECV` (223) : receive (non-blocking)
28//! - `SYS_CHAN_CLOSE`  (224) : destroy the channel
29
30pub mod channel;
31pub mod lifecycle;
32pub mod message;
33pub mod port;
34pub mod reply;
35pub mod semaphore;
36pub mod shared_ring;
37pub mod test;
38
39pub use channel::{
40    channel, create_channel, destroy_channel, get_channel, ChanId, ChannelError, Receiver, Sender,
41    SyncChan,
42};
43pub use lifecycle::{MultiHandleDestroyError, MultiHandleResource};
44pub use message::IpcMessage;
45pub use port::{create_port, destroy_port, get_port, IpcError, Port, PortId};
46pub use semaphore::{
47    create_semaphore, destroy_semaphore, get_semaphore, PosixSemaphore, SemId, SemaphoreError,
48};
49pub use shared_ring::{create_ring, destroy_ring, get_ring, RingError, RingId, SharedRing};