pub unsafe fn clone(
cb: CloneCb<'_>,
stack: &mut [u8],
flags: CloneFlags,
signal: Option<c_int>,
) -> Result<Pid>
Expand description
clone
create a child process
(clone(2)
)
stack
is a reference to an array which will hold the stack of the new
process. Unlike when calling clone(2)
from C, the provided stack
address need not be the highest address of the region. Nix will take
care of that requirement. The user only needs to provide a reference to
a normally allocated buffer.
ยงSafety
Because clone
creates a child process with its stack located in
stack
without specifying the size of the stack, special care must be
taken to ensure that the child process does not overflow the provided
stack space.
See fork
for additional safety concerns related
to executing child processes.