Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ipc_recv (nr 507)

Receive a message from an IPC channel (blocking).

Signature

ipc_recv(fd: i32, msg_ptr: *mut IpcMessage, flags: u32) → 0 or -errno

Arguments

ArgRegisterDescription
fdrdiChannel recv-end fd (from ipc_create)
msg_ptrrsiPointer to IpcMessage buffer for received message
flagsrdxIPC_NONBLOCK (0x1) for non-blocking mode

Return value

On success, writes the received message to msg_ptr and returns 0.

Errors

ErrorCondition
EFAULTmsg_ptr is invalid
EBADFfd is not a valid channel recv-end
EPIPESend end has been closed and channel is empty
EAGAINIPC_NONBLOCK set and no message available
EMFILEfd table full during fd transfer installation

Description

Receives a message from the channel. If no message is available and IPC_NONBLOCK is not set, the calling thread blocks until a sender posts a message.

If the received message carries file descriptors (msg.fds entries != -1), the transferred fd objects are installed in the receiver’s fd table and the fds array is rewritten with the new fd numbers before being copied to user memory.

For async (non-blocking, multiplexed) receiving, use OP_IPC_RECV via io_submit instead.

Implementation

osl/src/ipc.rssys_ipc_recv

See also