Function memcpy_fallible

Source
unsafe fn memcpy_fallible(dst: *mut u8, src: *const u8, len: usize) -> usize
Expand description

Copies len bytes from src to dst. This function will early stop copying if encountering an unresolvable page fault.

Returns the number of successfully copied bytes.

In the following cases, this method may cause unexpected bytes to be copied, but will not cause safety problems as long as the safety requirements are met:

  • The source and destination overlap.
  • The current context is not associated with valid user space (e.g., in the kernel thread).
  • src must either be [valid] for reads of len bytes or be in user space for len bytes

  • dst must either be [valid] for writes of len bytes or be in user space for len bytes