diff --git a/components/profile/lib.rs b/components/profile/lib.rs index 08971cb3e0f..ed54b593adb 100644 --- a/components/profile/lib.rs +++ b/components/profile/lib.rs @@ -4,7 +4,6 @@ #![feature(box_syntax)] #![feature(iter_arith)] -#![cfg_attr(target_os="linux", feature(page_size))] #![feature(slice_splits)] #[macro_use] extern crate log; diff --git a/components/profile/mem.rs b/components/profile/mem.rs index ff9a19ecc36..34254e83bbd 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -436,6 +436,13 @@ mod system_reporter { ($e:expr) => (match $e { Some(e) => e, None => return None }) ); + #[cfg(target_os="linux")] + fn page_size() -> usize { + unsafe { + ::libc::sysconf(::libc::_SC_PAGESIZE) as usize + } + } + #[cfg(target_os="linux")] fn get_proc_self_statm_field(field: usize) -> Option { use std::fs::File; @@ -446,7 +453,7 @@ mod system_reporter { option_try!(f.read_to_string(&mut contents).ok()); let s = option_try!(contents.split_whitespace().nth(field)); let npages = option_try!(s.parse::().ok()); - Some(npages * ::std::env::page_size()) + Some(npages * page_size()) } #[cfg(target_os="linux")]