Skip to content

Commit

Permalink
Use __errno_location on DragonFly BSD
Browse files Browse the repository at this point in the history
DragonFly BSD 5.8+ has __errno_location.
DragonFlyBSD/DragonFlyBSD@60d3113
  • Loading branch information
taiki-e committed Oct 2, 2023
1 parent 70d3d0f commit 9679802
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ features = [
"Win32_System_Diagnostics_Debug",
]

[target.'cfg(target_os="dragonfly")'.dependencies]
errno-dragonfly = "0.1.2"

[target.'cfg(target_os="wasi")'.dependencies]
libc = { version = "0.2", default-features = false }

Expand Down
10 changes: 6 additions & 4 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
// except according to those terms.

use core::str;
#[cfg(target_os = "dragonfly")]
use errno_dragonfly::errno_location;
use libc::{self, c_char, c_int, size_t, strlen};

use crate::Errno;
Expand Down Expand Up @@ -57,7 +55,6 @@ pub fn set_errno(Errno(errno): Errno) {
}

extern "C" {
#[cfg(not(target_os = "dragonfly"))]
#[cfg_attr(
any(target_os = "macos", target_os = "ios", target_os = "freebsd"),
link_name = "__error"
Expand All @@ -78,7 +75,12 @@ extern "C" {
)]
#[cfg_attr(target_os = "haiku", link_name = "_errnop")]
#[cfg_attr(
any(target_os = "linux", target_os = "hurd", target_os = "redox"),
any(
target_os = "linux",
target_os = "hurd",
target_os = "redox",
target_os = "dragonfly"
),
link_name = "__errno_location"
)]
#[cfg_attr(target_os = "aix", link_name = "_Errno")]
Expand Down

0 comments on commit 9679802

Please sign in to comment.