#procfs

linux-procfs

The linux-procfs is the data snap library for the /proc/ filesystem on the linux os

5 releases

Uses new Rust 2021

0.3.11 Jun 13, 2022
0.3.10 Nov 14, 2021
0.3.9 Sep 10, 2021
0.3.7 Jul 6, 2021

#69 in Unix APIs

Download history 4/week @ 2022-03-09 24/week @ 2022-03-16 13/week @ 2022-03-23 9/week @ 2022-03-30 9/week @ 2022-04-06 5/week @ 2022-04-13 6/week @ 2022-04-20 33/week @ 2022-04-27 24/week @ 2022-05-04 65/week @ 2022-05-11 24/week @ 2022-05-18 26/week @ 2022-05-25 43/week @ 2022-06-01 29/week @ 2022-06-08 39/week @ 2022-06-15 9/week @ 2022-06-22

124 downloads per month
Used in ps-mem

MIT/Apache

305KB
2.5K SLoC

linux-procfs

The linux-procfs crate is the data snap library for the /proc/ filesystem on the linux os.

This crate reads from /proc filesystem, scanne it, stores the value into the struct and returns it. This scans and holds only the required values by specifying feature.

Feature

  • minimum support rustc 1.56.1 (59eed8a2a 2021-11-01)

Example

Example 1: load average

use linux_procfs::System;
let mut sys = System::new("/");
let loadavg = sys.get_loadavg();
println!("{}, {}, {}, {}", loadavg.a1, loadavg.a5, loadavg.a15, loadavg.last_pid);

Example 2: disk stats

use linux_procfs::System;
let mut sys = System::new("/");
let diskstats = sys.get_diskstats();
for disk in diskstats.disks {
    println!("{}, {}, {}", disk.name, disk.rblk, disk.wblk);
}

Changelogs

This crate's changelog here.

License

This project is licensed under either of

at your option.

Dependencies