Skip to content

Commit f5ee22d

Browse files
committed
DragonFlyBSD: use __errno_location now provided by the libc crate
This obviates the need for the C language shim for this variable, which this commit removes.
1 parent 2c24405 commit f5ee22d

File tree

4 files changed

+4
-34
lines changed

4 files changed

+4
-34
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ exclude = [
1717
]
1818

1919
[dependencies]
20-
libc = { version = "0.2.73", features = [ "extra_traits" ] }
20+
libc = { version = "0.2.77", features = [ "extra_traits" ] }
2121
bitflags = "1.1"
2222
cfg-if = "0.1.10"
2323

build.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/errno.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use cfg_if::cfg_if;
2-
#[cfg(not(target_os = "dragonfly"))]
32
use libc::{c_int, c_void};
43
use std::{fmt, io, error};
54
use crate::{Error, Result};
@@ -13,32 +12,15 @@ cfg_if! {
1312
unsafe fn errno_location() -> *mut c_int {
1413
libc::__error()
1514
}
16-
} else if #[cfg(target_os = "dragonfly")] {
17-
// DragonFly uses a thread-local errno variable, but #[thread_local] is
18-
// feature-gated and not available in stable Rust as of this writing
19-
// (Rust 1.21.0). We have to use a C extension to access it
20-
// (src/errno_dragonfly.c).
21-
//
22-
// Tracking issue for `thread_local` stabilization:
23-
//
24-
// https://github.com/rust-lang/rust/issues/29594
25-
//
26-
// Once this becomes stable, we can remove build.rs,
27-
// src/errno_dragonfly.c, and use:
28-
//
29-
// extern { #[thread_local] static errno: c_int; }
30-
//
31-
#[link(name="errno_dragonfly", kind="static")]
32-
extern {
33-
pub fn errno_location() -> *mut c_int;
34-
}
3515
} else if #[cfg(any(target_os = "android",
3616
target_os = "netbsd",
3717
target_os = "openbsd"))] {
3818
unsafe fn errno_location() -> *mut c_int {
3919
libc::__errno()
4020
}
41-
} else if #[cfg(any(target_os = "linux", target_os = "redox"))] {
21+
} else if #[cfg(any(target_os = "linux",
22+
target_os = "redox",
23+
target_os = "dragonfly"))] {
4224
unsafe fn errno_location() -> *mut c_int {
4325
libc::__errno_location()
4426
}

src/errno_dragonfly.c

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)