Skip to content

Commit

Permalink
Rollup merge of rust-lang#47352 - EdSchouten:cloudabi-libtest, r=kennytm
Browse files Browse the repository at this point in the history
Make libtest build on CloudABI.

Just like on UNIX systems, we need to use sysconf() to obtain the number
of CPUs. Extend the existing cfg()'s to match CloudABI as well.
  • Loading branch information
kennytm committed Jan 12, 2018
2 parents f589482 + 9babb8a commit a63121c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@

#![feature(asm)]
#![feature(fnbox)]
#![cfg_attr(unix, feature(libc))]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
#![feature(set_stdio)]
#![feature(panic_unwind)]
#![feature(staged_api)]

extern crate getopts;
extern crate term;
#[cfg(unix)]
#[cfg(any(unix, target_os = "cloudabi"))]
extern crate libc;
extern crate panic_unwind;

Expand Down Expand Up @@ -1191,13 +1191,14 @@ fn get_concurrency() -> usize {
1
}

#[cfg(any(target_os = "linux",
target_os = "macos",
target_os = "ios",
target_os = "android",
target_os = "solaris",
#[cfg(any(target_os = "android",
target_os = "cloudabi",
target_os = "emscripten",
target_os = "fuchsia"))]
target_os = "fuchsia",
target_os = "ios",
target_os = "linux",
target_os = "macos",
target_os = "solaris"))]
fn num_cpus() -> usize {
unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as usize }
}
Expand Down

0 comments on commit a63121c

Please sign in to comment.