Skip to content

Commit

Permalink
feat: export the SYS_ERRNO symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroening committed Jan 7, 2025
1 parent 9443c13 commit 08c8bdb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/errno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,22 @@ pub const EHWPOISON: i32 = 133;
not(any(feature = "common-os", feature = "nostd")),
not(target_arch = "riscv64")
))]
#[unsafe(no_mangle)]
#[thread_local]
pub(crate) static SYS_ERRNO: core::cell::UnsafeCell<i32> = core::cell::UnsafeCell::new(0);
pub static SYS_ERRNO: core::cell::UnsafeCell<i32> = core::cell::UnsafeCell::new(0);

/// Get the error number from the thread local storage
///
/// Soft-deprecated in favor of accessing [`SYS_ERRNO`] directly.
#[cfg(not(feature = "nostd"))]
#[unsafe(no_mangle)]
pub extern "C" fn sys_get_errno() -> i32 {
sys_errno()
}

/// Get the error number from the thread local storage
///
/// Soft-deprecated in favor of accessing [`SYS_ERRNO`] directly.
#[cfg(not(feature = "nostd"))]
#[unsafe(no_mangle)]
pub extern "C" fn sys_errno() -> i32 {
Expand Down

0 comments on commit 08c8bdb

Please sign in to comment.