Skip to content

Commit efc3c71

Browse files
authored
Rollup merge of #112525 - hermitcore:devel, r=m-ou-se
Adjustments for RustyHermit The interface between `libstd` and the OS changed and some changes are not correctly merged for RustHermit. For instance, the crate `hermit_abi` isn't defined as public, although it provided the socket interface for the application. In addition, the support of thread::available_parallelism is realized. It returns the number of available processors.
2 parents 7bd81ee + 8666ade commit efc3c71

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

Cargo.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -1529,9 +1529,9 @@ dependencies = [
15291529

15301530
[[package]]
15311531
name = "hermit-abi"
1532-
version = "0.3.1"
1532+
version = "0.3.2"
15331533
source = "registry+https://github.com/rust-lang/crates.io-index"
1534-
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
1534+
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
15351535
dependencies = [
15361536
"compiler_builtins",
15371537
"rustc-std-workspace-alloc",
@@ -1864,7 +1864,7 @@ version = "1.0.11"
18641864
source = "registry+https://github.com/rust-lang/crates.io-index"
18651865
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
18661866
dependencies = [
1867-
"hermit-abi 0.3.1",
1867+
"hermit-abi 0.3.2",
18681868
"libc",
18691869
"windows-sys 0.48.0",
18701870
]
@@ -1881,7 +1881,7 @@ version = "0.4.8"
18811881
source = "registry+https://github.com/rust-lang/crates.io-index"
18821882
checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb"
18831883
dependencies = [
1884-
"hermit-abi 0.3.1",
1884+
"hermit-abi 0.3.2",
18851885
"rustix 0.38.2",
18861886
"windows-sys 0.48.0",
18871887
]
@@ -2396,7 +2396,7 @@ version = "1.16.0"
23962396
source = "registry+https://github.com/rust-lang/crates.io-index"
23972397
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
23982398
dependencies = [
2399-
"hermit-abi 0.3.1",
2399+
"hermit-abi 0.3.2",
24002400
"libc",
24012401
]
24022402

@@ -4819,7 +4819,7 @@ dependencies = [
48194819
"dlmalloc",
48204820
"fortanix-sgx-abi",
48214821
"hashbrown 0.14.0",
4822-
"hermit-abi 0.3.1",
4822+
"hermit-abi 0.3.2",
48234823
"libc",
48244824
"miniz_oxide",
48254825
"object",

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dlmalloc = { version = "0.2.3", features = ['rustc-dep-of-std'] }
4545
fortanix-sgx-abi = { version = "0.5.0", features = ['rustc-dep-of-std'], public = true }
4646

4747
[target.'cfg(target_os = "hermit")'.dependencies]
48-
hermit-abi = { version = "0.3.0", features = ['rustc-dep-of-std'] }
48+
hermit-abi = { version = "0.3.2", features = ['rustc-dep-of-std'], public = true }
4949

5050
[target.wasm32-wasi.dependencies]
5151
wasi = { version = "0.11.0", features = ['rustc-dep-of-std'], default-features = false }

library/std/src/sys/hermit/thread.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![allow(dead_code)]
22

3-
use super::unsupported;
43
use crate::ffi::CStr;
54
use crate::io;
65
use crate::mem;
@@ -99,7 +98,7 @@ impl Thread {
9998
}
10099

101100
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
102-
unsupported()
101+
unsafe { Ok(NonZeroUsize::new_unchecked(abi::get_processor_count())) }
103102
}
104103

105104
pub mod guard {

library/std/src/sys/hermit/time.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Timespec {
4040
}
4141

4242
fn checked_add_duration(&self, other: &Duration) -> Option<Timespec> {
43-
let mut secs = self.tv_sec.checked_add_unsigned(other.as_secs())?;
43+
let mut secs = self.t.tv_sec.checked_add_unsigned(other.as_secs())?;
4444

4545
// Nano calculations can't overflow because nanos are <1B which fit
4646
// in a u32.
@@ -53,7 +53,7 @@ impl Timespec {
5353
}
5454

5555
fn checked_sub_duration(&self, other: &Duration) -> Option<Timespec> {
56-
let mut secs = self.tv_sec.checked_sub_unsigned(other.as_secs())?;
56+
let mut secs = self.t.tv_sec.checked_sub_unsigned(other.as_secs())?;
5757

5858
// Similar to above, nanos can't overflow.
5959
let mut nsec = self.t.tv_nsec as i32 - other.subsec_nanos() as i32;

0 commit comments

Comments
 (0)