pub fn kernel_config() -> ProcResult<HashMap<String, ConfigSetting>> {
    use libflate::gzip::Decoder;
    use std::io::{BufRead, BufReader};

    let file = proctry!(File::open("/proc/config.gz"));
    let decoder = proctry!(Decoder::new(file));
    let reader = BufReader::new(decoder);

    let mut map = HashMap::new();

    for line in reader.lines() {
        let line = proctry!(line);
        if line.starts_with('#') {
            continue;
        }
        if line.contains('=') {
            let mut s = line.splitn(2, '=');
            let name = expect!(s.next()).to_owned();
            let value = match expect!(s.next()) {
                "y" => ConfigSetting::Yes,
                "m" => ConfigSetting::Module,
                s => ConfigSetting::Value(s.to_owned()),
            };
            map.insert(name, value);
        }
    }

    ProcResult::Ok(map)
}
/// Returns a configuration options used to build the currently running kernel
///
/// (since Linux 2.6 and requires CONFIG_IKCONFIG_PROC)
Returns a configuration options used to build the currently running kernel
(since Linux 2.6 and requires CONFIG_IKCONFIG_PROC)
Returns a configuration options used to build the currently running kernel ( since Linux 2 . 6 and requires CONFIG_IKCONFIG_PROC )
pub fn kernel_config() -> ProcResult<HashMap<String, ConfigSetting>> {
    use libflate::gzip::Decoder;
    use std::io::{BufRead, BufReader};
    let file = proctry!(File::open("/proc/config.gz"));
    let decoder = proctry!(Decoder::new(file));
    let reader = BufReader::new(decoder);
    let mut map = HashMap::new();
    for line in reader.lines() {
        let line = proctry!(line);
        if line.starts_with('#') {
            continue;
        }
        if line.contains('=') {
            let mut s = line.splitn(2, '=');
            let name = expect!(s.next()).to_owned();
            let value = match expect!(s.next()) {
                "y" => ConfigSetting::Yes,
                "m" => ConfigSetting::Module,
                s => ConfigSetting::Value(s.to_owned()),
            };
            map.insert(name, value);
        }
    }
    ProcResult::Ok(map)
}
pub fn kernel_config ( ) -> ProcResult < HashMap < String , ConfigSetting > > { use libflate :: gzip :: Decoder ; use std :: io :: { BufRead , BufReader } ; let file = proctry ! ( File open ( " " ) ) ; let decoder = proctry ! ( Decoder new ( file ) ) ; let reader = BufReader :: new ( decoder ) ; let mut map = HashMap :: new ( ) ; for line in reader . lines ( ) { let line = proctry ! ( line ) ; if line . starts_with ( '#' ) { continue ; } if line . contains ( '=' ) { let mut s = line . splitn ( 2 , '=' ) ; let name = expect ! ( s next ( ) ) . to_owned ( ) ; let value = match expect ! ( s next ( ) ) { " " => ConfigSetting :: Yes , " " => ConfigSetting :: Module , s => ConfigSetting :: Value ( s . to_owned ( ) ) , } ; map . insert ( name , value ) ; } } ProcResult :: Ok ( map ) }
Returns a configuration options used to build the currently running kernel
(since Linux 2.6 and requires CONFIG_IKCONFIG_PROC)
Returns a configuration options used to build the currently running kernel ( since Linux 2 . 6 and requires CONFIG_IKCONFIG_PROC )