feat: add nix demo
This commit is contained in:
14
__linux/nix-demo/src/main.rs
Normal file
14
__linux/nix-demo/src/main.rs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user