未验证 提交 a63121c5 编写于 作者: K kennytm

Rollup merge of #47352 - EdSchouten:cloudabi-libtest, r=kennytm

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.
......@@ -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;
......@@ -1191,13 +1191,14 @@ fn num_cpus() -> 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 }
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册