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 message;
32pub mod port;
33pub mod reply;
34pub mod semaphore;
35pub mod shared_ring;
36pub mod test;
37
38pub use channel::{
39 channel, create_channel, destroy_channel, get_channel, ChanId, ChannelError, Receiver, Sender,
40 SyncChan,
41};
42pub use message::IpcMessage;
43pub use port::{create_port, destroy_port, get_port, IpcError, Port, PortId};
44pub use semaphore::{
45 create_semaphore, destroy_semaphore, get_semaphore, PosixSemaphore, SemId, SemaphoreError,
46};
47pub use shared_ring::{create_ring, destroy_ring, get_ring, RingError, RingId, SharedRing};