The libc
crate is 'feature gated' and can only be accessed on nightly Rust versions until it is considered stable.
#![feature(libc)]
extern crate libc;
use libc::pid_t;
#[link(name = "c")]
extern {
fn getpid() -> pid_t;
}
fn main() {
let x = unsafe { getpid() };
println!("Process PID is {}", x);
}