Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. syscall_defs
  6. channel_read

channel_read

Function channel_read 

Source
pub unsafe extern "C" fn channel_read(
    object_handle: u32,
    offset: usize,
    buffer: *mut u8,
    buffer_len: usize,
) -> isize
Expand description

Perform a non-blocking read from a pending transaction.

Attempts to read up to buf_len bytes from the send_buffer of the pending transaction starting from offset. The kernel will copy the data from the initiators send_buffer into buffer before returning.

The maximum size of buffer that may be passed is isize::MAX.

§Returns

  • >=0: Number of bytes read from the send_buffer.
  • Error::InvalidArgument: object_handle is not a valid handler channel object.
  • Error::OutOfRange: A read was requested outside the bound of the initiator’s send_buffer.
  • Error::Unavailable: No transaction was pending on the channel. This can happen in the middle of handling a transaction if the initiator cancels the transaction.
  • Error::PermissionDenied: buffer does not reference a valid memory region in this processes’ address space.
  • TODO: What error should be returned if the initiator’s send_buffer is invalid. Is that also permission denied?