Function sys_read

Source
#[no_mangle]
pub unsafe extern "C" fn sys_read(
    fd: u32,
    recv_ptr: *mut u8,
    nread: usize,
) -> usize
Expand description

Reads the given number of bytes into the given buffer, posix-style. Returns the number of bytes actually read. On end of file, returns 0.

Like POSIX read, this is not guaranteed to read all bytes requested. If we haven’t reached EOF, it is however guaranteed to read at least one byte.

Users should prefer a higher-level abstraction.

§Safety

recv_ptr must be aligned and dereferenceable.