#linux #proc #mounts #swaps

proc-mounts

Fetch active mounts and swaps on a Linux system

8 releases

Uses old Rust 2015

0.2.4 Apr 9, 2020
0.2.3 Nov 8, 2019
0.2.2 Feb 20, 2019
0.1.2 Jan 3, 2019
0.1.0 Nov 2, 2018

#43 in Unix APIs

Download history 872/week @ 2021-02-24 1018/week @ 2021-03-03 897/week @ 2021-03-10 651/week @ 2021-03-17 910/week @ 2021-03-24 601/week @ 2021-03-31 1168/week @ 2021-04-07 1449/week @ 2021-04-14 1554/week @ 2021-04-21 1369/week @ 2021-04-28 1191/week @ 2021-05-05 1173/week @ 2021-05-12 1111/week @ 2021-05-19 868/week @ 2021-05-26 829/week @ 2021-06-02 1158/week @ 2021-06-09

4,552 downloads per month
Used in redoxer

MIT license

26KB
611 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.5–1MB
~21K SLoC