Skip to content

Instantly share code, notes, and snippets.

@hayajo
Created July 20, 2016 08:10
Show Gist options
  • Save hayajo/a4260e0f232245670d94fb5030349d86 to your computer and use it in GitHub Desktop.
Save hayajo/a4260e0f232245670d94fb5030349d86 to your computer and use it in GitHub Desktop.
Rustで自身のPIDを取得する
extern crate libc;
use libc::pid_t;
fn pid() -> pid_t {
unsafe { libc::getpid() }
}
fn main() {
println!("{}", pid());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment