#linux #proc #mounts #swaps

proc-mounts

Fetch active mounts and swaps on a Linux system

3 releases

0.1.2 Jan 3, 2019
0.1.1 Dec 3, 2018
0.1.0 Nov 2, 2018

#139 in Unix APIs

Download history 16/week @ 2018-11-08 4/week @ 2018-11-15 2/week @ 2018-11-22 7/week @ 2018-11-29 16/week @ 2018-12-06 10/week @ 2018-12-13 5/week @ 2018-12-20 15/week @ 2018-12-27 17/week @ 2019-01-03 17/week @ 2019-01-10 9/week @ 2019-01-17

33 downloads per month

MIT license

21KB
455 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

~1MB
~21K SLoC