Skip to content

Commit b531ca7

Browse files
committed
Auto merge of rust-lang#3629 - devnexen:illumos_num_cpus, r=RalfJung
solarish platform: add support for available-parallelism.
2 parents 0963353 + d3974fa commit b531ca7

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

src/tools/miri/ci/ci.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ case $HOST_TARGET in
148148
UNIX="panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
149149
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
150150
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
151-
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX threadname pthread-sync libc-time
152-
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX threadname pthread-sync libc-time
151+
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time
152+
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time
153153
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX
154154
TEST_TARGET=wasm32-wasip2 run_tests_minimal empty_main wasm heap_alloc libc-mem
155155
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal empty_main wasm

src/tools/miri/src/shims/unix/solarish/foreign_items.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,36 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
6969
this.write_null(dest)?;
7070
}
7171

72+
"pset_info" => {
73+
let [pset, tpe, cpus, list] =
74+
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
75+
// We do not need to handle the current process cpu mask, available_parallelism
76+
// implementation pass null anyway. We only care for the number of
77+
// cpus.
78+
// https://docs.oracle.com/cd/E88353_01/html/E37841/pset-info-2.html
79+
80+
let pset = this.read_scalar(pset)?.to_i32()?;
81+
let tpe = this.read_pointer(tpe)?;
82+
let list = this.read_pointer(list)?;
83+
84+
let ps_myid = this.eval_libc_i32("PS_MYID");
85+
if ps_myid != pset {
86+
throw_unsup_format!("pset_info is only supported with pset==PS_MYID");
87+
}
88+
89+
if !this.ptr_is_null(tpe)? {
90+
throw_unsup_format!("pset_info is only supported with type==NULL");
91+
}
92+
93+
if !this.ptr_is_null(list)? {
94+
throw_unsup_format!("pset_info is only supported with list==NULL");
95+
}
96+
97+
let cpus = this.deref_pointer(cpus)?;
98+
this.write_scalar(Scalar::from_u32(this.machine.num_cpus), &cpus)?;
99+
this.write_null(dest)?;
100+
}
101+
72102
_ => return Ok(EmulateItemResult::NotSupported),
73103
}
74104
Ok(EmulateItemResult::NeedsReturn)

0 commit comments

Comments
 (0)