From e455183d59c4dbbc588c6971f872ae7b7ffcd626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Fri, 3 Jan 2025 16:22:45 +0100 Subject: [PATCH] feat: add `sys_errno_location` --- src/errno.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/errno.rs b/src/errno.rs index 5625bad685..621b217060 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -423,6 +423,18 @@ pub extern "C" fn sys_errno() -> i32 { } } +#[cfg(not(feature = "nostd"))] +#[unsafe(no_mangle)] +pub extern "C" fn sys_errno_location() -> *mut i32 { + cfg_if::cfg_if! { + if #[cfg(any(feature = "common-os", target_arch = "riscv64"))] { + unimplemented!("sys_errno_location") + } else { + ERRNO.get() + } + } +} + pub(crate) trait ToErrno { fn to_errno(&self) -> Option { None