Crates.io | lpfs |
lib.rs | lpfs |
version | 0.2.0 |
source | src |
created_at | 2019-11-24 18:55:39.322545 |
updated_at | 2020-02-02 09:47:49.502055 |
description | Retriving infomations from linux proc filesystem |
homepage | |
repository | https://github.com/pearzl/lpfs |
max_upload_size | |
id | 184018 |
size | 207,416 |
The goal of this repo is to make retriving system informations reside in proc file system easier.
use lpfs::proc::*;
use lpfs::pid::*;
fn main() {
// /proc/stat
println!("{:?}", stat().unwrap());
// /proc/1/stat
println!("{:?}", stat_of(1).unwrap());
}
eminence/procfs is a similar crate with different interface design.
Each file is retrived by a function reside in lpfs::proc
with same name.
For example, lpfs::proc::cmdline
retrive from /proc/cmdline
.
It's similar with top-level files, here is an example with stat
.
function | file |
---|---|
stat_of(pid) | /proc/[pid]/stat |
stat_self() | /proc/self/stat |
stat_of_task(pid, tid) | /proc/[pid]/task/[tid]/stat |
stat_self_task(tid) | /proc/self/task/[tid]/stat |
These functions reside in lpfs::pid
rust 2018 (rustc 1.31.0 +)
all linux distribution with 3.+ kernel version.