Skip to content

Commit 9babb8a

Browse files
committed
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.
1 parent 619ced0 commit 9babb8a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/libtest/lib.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636

3737
#![feature(asm)]
3838
#![feature(fnbox)]
39-
#![cfg_attr(unix, feature(libc))]
39+
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
4040
#![feature(set_stdio)]
4141
#![feature(panic_unwind)]
4242
#![feature(staged_api)]
4343

4444
extern crate getopts;
4545
extern crate term;
46-
#[cfg(unix)]
46+
#[cfg(any(unix, target_os = "cloudabi"))]
4747
extern crate libc;
4848
extern crate panic_unwind;
4949

@@ -1191,13 +1191,14 @@ fn get_concurrency() -> usize {
11911191
1
11921192
}
11931193

1194-
#[cfg(any(target_os = "linux",
1195-
target_os = "macos",
1196-
target_os = "ios",
1197-
target_os = "android",
1198-
target_os = "solaris",
1194+
#[cfg(any(target_os = "android",
1195+
target_os = "cloudabi",
11991196
target_os = "emscripten",
1200-
target_os = "fuchsia"))]
1197+
target_os = "fuchsia",
1198+
target_os = "ios",
1199+
target_os = "linux",
1200+
target_os = "macos",
1201+
target_os = "solaris"))]
12011202
fn num_cpus() -> usize {
12021203
unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as usize }
12031204
}

0 commit comments

Comments
 (0)