mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Have our copy of the now deprecated std::env::page_size
This commit is contained in:
parent
f10851e788
commit
85aa1658cc
2 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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<usize> {
|
||||
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::<usize>().ok());
|
||||
Some(npages * ::std::env::page_size())
|
||||
Some(npages * page_size())
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue