#linux #proc #mounts #swaps

proc-mounts

Fetch active mounts and swaps on a Linux system

7 releases

0.2.3 Nov 8, 2019
0.2.2 Feb 20, 2019
0.1.2 Jan 3, 2019
0.1.1 Dec 3, 2018
0.1.0 Nov 2, 2018

#39 in Unix APIs

Download history 69/week @ 2019-08-09 116/week @ 2019-08-16 157/week @ 2019-08-23 47/week @ 2019-08-30 218/week @ 2019-09-06 178/week @ 2019-09-13 53/week @ 2019-09-20 24/week @ 2019-09-27 400/week @ 2019-10-04 652/week @ 2019-10-11 555/week @ 2019-10-18 524/week @ 2019-10-25 484/week @ 2019-11-01

1,162 downloads per month
Used in 1 crate

MIT license

27KB
617 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

~0.7–1MB
~22K SLoC