From 967980222fabf624fd1b44842cd3dbfa9c0b21be Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 2 Oct 2023 20:50:19 +0900 Subject: [PATCH] Use __errno_location on DragonFly BSD DragonFly BSD 5.8+ has __errno_location. https://github.com/DragonFlyBSD/DragonFlyBSD/commit/60d311380ff2bf02a87700a0f3e6eb53e6034920 --- Cargo.toml | 3 --- src/unix.rs | 10 ++++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 354d809..a2d5360 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 } diff --git a/src/unix.rs b/src/unix.rs index c61528a..86a35d9 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -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; @@ -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" @@ -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")]