about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-02-29 14:33:51 +0100
committerGitHub <noreply@github.com>2024-02-29 14:33:51 +0100
commitad74598dbc9fb815c5f0961ab5d0a2201753b607 (patch)
tree540ca39e300351497fbf5c874e3cf79b3f632e04 /library/std/src/sys
parentb2c32799846ea94012971c39a5ba37dc8c983798 (diff)
parent3726cbb5fefe28c922f5c265231a3d00bca198d5 (diff)
downloadrust-ad74598dbc9fb815c5f0961ab5d0a2201753b607.tar.gz
rust-ad74598dbc9fb815c5f0961ab5d0a2201753b607.zip
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.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/pal/hermit/os.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/library/std/src/sys/pal/hermit/os.rs b/library/std/src/sys/pal/hermit/os.rs
index a54536aecb8..645f0dc1e31 100644
--- a/library/std/src/sys/pal/hermit/os.rs
+++ b/library/std/src/sys/pal/hermit/os.rs
@@ -14,15 +14,15 @@ use crate::sys::unsupported;
 use crate::vec;
 
 pub fn errno() -> i32 {
-    0
+    unsafe { abi::get_errno() }
 }
 
-pub fn error_string(_errno: i32) -> String {
-    "operation successful".to_string()
+pub fn error_string(errno: i32) -> String {
+    abi::error_string(errno).to_string()
 }
 
 pub fn getcwd() -> io::Result<PathBuf> {
-    unsupported()
+    Ok(PathBuf::from("/"))
 }
 
 pub fn chdir(_: &path::Path) -> io::Result<()> {
@@ -188,7 +188,7 @@ pub fn unsetenv(k: &OsStr) -> io::Result<()> {
 }
 
 pub fn temp_dir() -> PathBuf {
-    panic!("no filesystem on hermit")
+    PathBuf::from("/tmp")
 }
 
 pub fn home_dir() -> Option<PathBuf> {