Skip to content

Commit ad74598

Browse files
Rollup merge of #121765 - hermit-os:errno, r=ChrisDenton
add platform-specific function to get the error number for HermitOS Extending `std` to get the last error number for HermitOS. HermitOS is a tier 3 platform and this PR changes only files, wich are related to the tier 3 platform.
2 parents b2c3279 + 3726cbb commit ad74598

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1640,9 +1640,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
16401640

16411641
[[package]]
16421642
name = "hermit-abi"
1643-
version = "0.3.6"
1643+
version = "0.3.9"
16441644
source = "registry+https://github.com/rust-lang/crates.io-index"
1645-
checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd"
1645+
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
16461646
dependencies = [
16471647
"compiler_builtins",
16481648
"rustc-std-workspace-alloc",

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dlmalloc = { version = "0.2.4", features = ['rustc-dep-of-std'] }
4848
fortanix-sgx-abi = { version = "0.5.0", features = ['rustc-dep-of-std'], public = true }
4949

5050
[target.'cfg(target_os = "hermit")'.dependencies]
51-
hermit-abi = { version = "0.3.2", features = ['rustc-dep-of-std'], public = true }
51+
hermit-abi = { version = "0.3.9", features = ['rustc-dep-of-std'], public = true }
5252

5353
[target.'cfg(target_os = "wasi")'.dependencies]
5454
wasi = { version = "0.11.0", features = ['rustc-dep-of-std'], default-features = false }

library/std/src/sys/pal/hermit/os.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ use crate::sys::unsupported;
1414
use crate::vec;
1515

1616
pub fn errno() -> i32 {
17-
0
17+
unsafe { abi::get_errno() }
1818
}
1919

20-
pub fn error_string(_errno: i32) -> String {
21-
"operation successful".to_string()
20+
pub fn error_string(errno: i32) -> String {
21+
abi::error_string(errno).to_string()
2222
}
2323

2424
pub fn getcwd() -> io::Result<PathBuf> {
25-
unsupported()
25+
Ok(PathBuf::from("/"))
2626
}
2727

2828
pub fn chdir(_: &path::Path) -> io::Result<()> {
@@ -188,7 +188,7 @@ pub fn unsetenv(k: &OsStr) -> io::Result<()> {
188188
}
189189

190190
pub fn temp_dir() -> PathBuf {
191-
panic!("no filesystem on hermit")
191+
PathBuf::from("/tmp")
192192
}
193193

194194
pub fn home_dir() -> Option<PathBuf> {

0 commit comments

Comments
 (0)