nc 0.9.7

Access system calls directly
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Create a child process.
///
/// # Examples
///
/// ```
/// let pid = unsafe { nc::fork() };
/// assert!(pid.is_ok());
/// let pid = pid.unwrap();
/// if pid == 0 {
///   println!("child process");
/// } else {
///   println!("parent process");
/// }
/// ```
pub unsafe fn fork() -> Result<pid_t, Errno> {
    syscall0(SYS_FORK).map(|ret| ret as pid_t)
}