Auto merge of #6707 - pcwalton:more-fds, r=larsbergstrom

script: Increase our file descriptor limit on Linux.

We've had problems with this before, and I think it's starting to cause
problems again.

See PRs #6629 and #6616; my current theory is that this is the problem.

r? @larsbergstrom

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6707)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-07-23 06:18:35 -06:00
commit 0d7744b198

View file

@ -94,9 +94,31 @@ mod devtools;
mod horribly_inefficient_timers;
mod webdriver_handlers;
#[cfg(any(target_os="linux", target_os="android"))]
#[allow(unsafe_code)]
fn perform_platform_specific_initialization() {
use std::mem;
const RLIMIT_NOFILE: libc::c_int = 7;
// Bump up our number of file descriptors to save us from impending doom caused by an onslaught
// of iframes.
unsafe {
let mut rlim = mem::uninitialized();
assert!(libc::getrlimit(RLIMIT_NOFILE, &mut rlim) == 0);
rlim.rlim_cur = rlim.rlim_max;
assert!(libc::setrlimit(RLIMIT_NOFILE, &mut rlim) == 0);
}
}
#[cfg(not(any(target_os="linux", target_os="android")))]
fn perform_platform_specific_initialization() {}
#[allow(unsafe_code)]
pub fn init() {
unsafe {
assert_eq!(js::jsapi::JS_Init(), 1);
}
perform_platform_specific_initialization();
}