feat: add nix demo

This commit is contained in:
2023-01-19 23:23:44 +08:00
parent 2e256c32f8
commit d1b1132cc3
4 changed files with 94 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
use nix::unistd::{getgid, gethostname, getpid, getuid};
fn main() {
let hostname = gethostname().unwrap();
println!("Hostname: {}", hostname.to_string_lossy());
let pid = getpid();
println!("Pid: {}", pid);
let uid = getuid();
println!("Uid: {}", uid);
let gid = getgid();
println!("Gid: {}", gid);
}