Skip to content

Commit 6f29e7a

Browse files
Rollup merge of rust-lang#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 18a5bfe + 0b89e67 commit 6f29e7a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

std/Cargo.toml

Lines changed: 1 addition & 1 deletion
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 }

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

Lines changed: 5 additions & 5 deletions
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)