1
1
use cfg_if:: cfg_if;
2
- #[ cfg( not( target_os = "dragonfly" ) ) ]
3
2
use libc:: { c_int, c_void} ;
4
3
use std:: { fmt, io, error} ;
5
4
use crate :: { Error , Result } ;
@@ -13,32 +12,15 @@ cfg_if! {
13
12
unsafe fn errno_location( ) -> * mut c_int {
14
13
libc:: __error( )
15
14
}
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
- }
35
15
} else if #[ cfg( any( target_os = "android" ,
36
16
target_os = "netbsd" ,
37
17
target_os = "openbsd" ) ) ] {
38
18
unsafe fn errno_location( ) -> * mut c_int {
39
19
libc:: __errno( )
40
20
}
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" ) ) ] {
42
24
unsafe fn errno_location( ) -> * mut c_int {
43
25
libc:: __errno_location( )
44
26
}
0 commit comments