#procfs

linux-procfs

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

9 releases

0.3.15 Feb 13, 2023
0.3.14 Jan 31, 2023
0.3.11 Jun 13, 2022
0.3.10 Nov 14, 2021
0.3.7 Jul 6, 2021

#105 in Unix APIs

Download history 4/week @ 2022-11-27 11/week @ 2022-12-04 18/week @ 2022-12-11 9/week @ 2022-12-18 12/week @ 2022-12-25 28/week @ 2023-01-01 52/week @ 2023-01-08 19/week @ 2023-01-15 20/week @ 2023-01-22 47/week @ 2023-01-29 200/week @ 2023-02-05 83/week @ 2023-02-12 46/week @ 2023-02-19 10/week @ 2023-02-26 14/week @ 2023-03-05 3/week @ 2023-03-12

75 downloads per month
Used in ps-mem

MIT/Apache

310KB
2.5K SLoC

linux-procfs

crate Docs Rust Version Apache2/MIT licensed Test ubu Test mac Test win

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.58.1 (db9d1b20b 2022-01-20)

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