Skip to content

Commit 2e3748a

Browse files
committed
Restore the __error() function, but add a deprecation warning.
1 parent c354c21 commit 2e3748a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// DragonFlyBSD's __error function is declared with "static inline", so it must
2+
// be implemented in the libc crate, as a pointer to a static thread_local.
3+
f! {
4+
#[deprecated(since = "0.2.77", "Use `__errno_location()` instead")]
5+
pub fn __error() -> *mut ::c_int {
6+
&mut errno
7+
}
8+
}
9+
10+
extern "C" {
11+
#[thread_local]
12+
pub static mut errno: ::c_int;
13+
}

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,3 +1078,10 @@ extern "C" {
10781078
needlelen: ::size_t,
10791079
) -> *mut ::c_void;
10801080
}
1081+
1082+
cfg_if! {
1083+
if #[cfg(libc_thread_local)] {
1084+
mod errno;
1085+
pub use self::errno::*;
1086+
}
1087+
}

0 commit comments

Comments
 (0)