Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DragonFlyBSD: use __errno_location now provided by the libc crate #1296

Merged
merged 1 commit into from
Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exclude = [
]

[dependencies]
libc = { version = "0.2.73", features = [ "extra_traits" ] }
libc = { version = "0.2.77", features = [ "extra_traits" ] }
bitflags = "1.1"
cfg-if = "0.1.10"

Expand Down
9 changes: 0 additions & 9 deletions build.rs

This file was deleted.

24 changes: 3 additions & 21 deletions src/errno.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use cfg_if::cfg_if;
#[cfg(not(target_os = "dragonfly"))]
use libc::{c_int, c_void};
use std::{fmt, io, error};
use crate::{Error, Result};
Expand All @@ -13,32 +12,15 @@ cfg_if! {
unsafe fn errno_location() -> *mut c_int {
libc::__error()
}
} else if #[cfg(target_os = "dragonfly")] {
// DragonFly uses a thread-local errno variable, but #[thread_local] is
// feature-gated and not available in stable Rust as of this writing
// (Rust 1.21.0). We have to use a C extension to access it
// (src/errno_dragonfly.c).
//
// Tracking issue for `thread_local` stabilization:
//
// https://github.com/rust-lang/rust/issues/29594
//
// Once this becomes stable, we can remove build.rs,
// src/errno_dragonfly.c, and use:
//
// extern { #[thread_local] static errno: c_int; }
//
#[link(name="errno_dragonfly", kind="static")]
extern {
pub fn errno_location() -> *mut c_int;
}
} else if #[cfg(any(target_os = "android",
target_os = "netbsd",
target_os = "openbsd"))] {
unsafe fn errno_location() -> *mut c_int {
libc::__errno()
}
} else if #[cfg(any(target_os = "linux", target_os = "redox"))] {
} else if #[cfg(any(target_os = "linux",
target_os = "redox",
target_os = "dragonfly"))] {
unsafe fn errno_location() -> *mut c_int {
libc::__errno_location()
}
Expand Down
3 changes: 0 additions & 3 deletions src/errno_dragonfly.c

This file was deleted.