Conditionally define macro that's only used in Linux builds.

This commit is contained in:
Josh Matthews 2017-05-29 14:52:44 -04:00
parent 74ff7f957f
commit be98fef8f7

View file

@ -505,11 +505,6 @@ mod system_reporter {
None
}
// Like std::macros::try!, but for Option<>.
macro_rules! option_try(
($e:expr) => (match $e { Some(e) => e, None => return None })
);
#[cfg(target_os = "linux")]
fn page_size() -> usize {
unsafe {
@ -522,6 +517,11 @@ mod system_reporter {
use std::fs::File;
use std::io::Read;
// Like std::macros::try!, but for Option<>.
macro_rules! option_try(
($e:expr) => (match $e { Some(e) => e, None => return None })
);
let mut f = option_try!(File::open("/proc/self/statm").ok());
let mut contents = String::new();
option_try!(f.read_to_string(&mut contents).ok());