Expand description
Bindings to the clone3
linux system call.
See the clone3 man page for more information.
This is a complex and generally unsafe operation. Users must understand the documentation to use it safely and correctly.
Examples
use clone3::Clone3;
let mut pidfd = -1;
let mut clone3 = Clone3::default();
clone3.flag_pidfd(&mut pidfd);
match unsafe { clone3.call() }.unwrap() {
0 => println!("i am the child"),
child => println!("i am the parent, my child has pid {} and my pidfd is {}", child, pidfd),
}
Features
The clone3 api can change in a backward compatible manner between Linux kernel versions. This
crate supports picking the target version through Cargo features like linux_5-5
, linux_5-7
.
The default is the newest kernel version. Specifying no linux
feature corresponds to the
initial clone3 api.
Structs
High level wrapper around the clone3 system call.
Arguments to the clone3 system call as defined in
/usr/include/linux/sched.h
.Flags for the clone3 system call as defined in
/usr/include/linux/sched.h
.Functions
The raw clone3 system call.