#mount #swap #linux #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

#122 in Unix APIs

Download history 4523/week @ 2024-03-14 5436/week @ 2024-03-21 4486/week @ 2024-03-28 4326/week @ 2024-04-04 4392/week @ 2024-04-11 5448/week @ 2024-04-18 6074/week @ 2024-04-25 4575/week @ 2024-05-02 3776/week @ 2024-05-09 4206/week @ 2024-05-16 3456/week @ 2024-05-23 4578/week @ 2024-05-30 4478/week @ 2024-06-06 4546/week @ 2024-06-13 4777/week @ 2024-06-20 3799/week @ 2024-06-27

18,489 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

~315–780KB
~18K SLoC