#linux #mount #swap #proc

proc-mounts

Fetch active mounts and swaps on a Linux system

9 releases

0.3.0 Mar 21, 2022
0.2.4 Apr 9, 2020
0.2.3 Nov 8, 2019
0.2.2 Feb 20, 2019
0.1.0 Nov 2, 2018

#230 in Unix APIs

Download history 3981/week @ 2024-06-17 5038/week @ 2024-06-24 3629/week @ 2024-07-01 4765/week @ 2024-07-08 6644/week @ 2024-07-15 7746/week @ 2024-07-22 8705/week @ 2024-07-29 9422/week @ 2024-08-05 6494/week @ 2024-08-12 6020/week @ 2024-08-19 5761/week @ 2024-08-26 5665/week @ 2024-09-02 5675/week @ 2024-09-09 6005/week @ 2024-09-16 6472/week @ 2024-09-23 6427/week @ 2024-09-30

24,913 downloads per month
Used in 26 crates (14 directly)

MIT license

24KB
531 lines

proc-mounts

Rust crate that provides easy access to data from the /proc/swaps and /proc/mounts files.

extern crate proc_mounts;

use proc_mounts::{MountIter, SwapIter};
use std::io;

fn main() -> io::Result<()> {
    println!("# Active Mounts");
    for mount in MountIter::new()? {
        println!("{:#?}", mount);
    }

    println!("# Active Swaps");
    for swap in SwapIter::new()? {
        println!("{:#?}", swap);
    }

    Ok(())
}

lib.rs:

Provides easy access to data from the /proc/swaps and /proc/mounts files.

extern crate proc_mounts;

use proc_mounts::{MountIter, SwapIter};
use std::io;

fn main() -> io::Result<()> {
    println!("# Active Mounts");
    for mount in MountIter::new()? {
        println!("{:#?}", mount);
    }

    println!("# Active Swaps");
    for swap in SwapIter::new()? {
        println!("{:#?}", swap);
    }

    Ok(())
}

Dependencies

~275–730KB
~17K SLoC