⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

sys_ipc_receive

Function sys_ipc_receive 

Source
pub fn sys_ipc_receive(_endpoint: u64, _buf: &mut [u8]) -> SyscallResult<usize>
Expand description

Receive a message from an IPC endpoint.

Blocks the calling process until a message is available on the specified IPC endpoint, then copies the message into the provided buffer. The endpoint is identified by a capability token that the receiver must possess with READ rights.

For small messages (64 bytes or fewer), the data is transferred via registers on the fast path. For larger messages, the kernel uses zero-copy page remapping so the receiver sees the sender’s data without any memory copy overhead.

The caller must provide a buffer large enough to hold the incoming message. If the buffer is too small, the message is truncated and a BufferTooSmall error is returned (the message remains consumed from the queue).

§Arguments

  • endpoint - Capability token identifying the IPC endpoint to receive from. The caller must hold this capability with at least READ rights.
  • buf - Mutable buffer to receive the message data. Should be at least as large as the expected maximum message size for the endpoint.

§Returns

  • Ok(bytes_received) - The number of bytes written into buf.

§Errors

§Examples

use veridian_kernel::pkg::sdk::syscall_api::sys_ipc_receive;

let endpoint: u64 = 0x1234; // capability token for the endpoint
let mut buf = [0u8; 4096];
let bytes = sys_ipc_receive(endpoint, &mut buf).expect("ipc receive failed");
let received = &buf[..bytes];
// Process the received message data