Function linux_api::sched::fork_raw

source ·
pub unsafe fn fork_raw() -> Result<c_long, Errno>
Expand description

See fork(2).

§Safety

Mostly safe, since most memory will be copy-on-write in the child process. Non-private mutable mappings are shared in the child, though, which may break soundness. (Such mappings aren’t common in practice)

Additionally some OS resources are shared with the parent, and others are dropped, which may /// break assumptions by code that uses or wraps such resources. See fork(2) for a full list, but some notable examples include:

  • The child shares file descriptors (and underlying file descriptions) with the parent.
  • The child is the only thread in the new process.