#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

#60 in Unix APIs

Download history 302/week @ 2019-12-02 245/week @ 2019-12-09 285/week @ 2019-12-16 102/week @ 2019-12-23 114/week @ 2019-12-30 314/week @ 2020-01-06 301/week @ 2020-01-13 262/week @ 2020-01-20 210/week @ 2020-01-27 161/week @ 2020-02-03 223/week @ 2020-02-10 313/week @ 2020-02-17 270/week @ 2020-02-24 228/week @ 2020-03-02 278/week @ 2020-03-09 434/week @ 2020-03-16

1,470 downloads per month
Used in redoxer

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.6–1MB
~21K SLoC