#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

#123 in Unix APIs

Download history 8659/week @ 2024-08-06 6516/week @ 2024-08-13 5755/week @ 2024-08-20 5895/week @ 2024-08-27 5572/week @ 2024-09-03 5887/week @ 2024-09-10 5861/week @ 2024-09-17 6467/week @ 2024-09-24 6750/week @ 2024-10-01 6630/week @ 2024-10-08 7059/week @ 2024-10-15 7191/week @ 2024-10-22 6534/week @ 2024-10-29 5179/week @ 2024-11-05 7225/week @ 2024-11-12 9400/week @ 2024-11-19

29,601 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

~230–680KB
~16K SLoC