File tree 6 files changed +31
-5
lines changed
bsd/freebsdlike/dragonfly
6 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -5,18 +5,17 @@ use std::str;
5
5
fn main ( ) {
6
6
let rustc_minor_ver =
7
7
rustc_minor_version ( ) . expect ( "Failed to get rustc version" ) ;
8
- let rustc_dep_of_std =
9
- std:: env:: var ( "CARGO_FEATURE_RUSTC_DEP_OF_STD" ) . is_ok ( ) ;
10
- let align_cargo_feature = std:: env:: var ( "CARGO_FEATURE_ALIGN" ) . is_ok ( ) ;
8
+ let rustc_dep_of_std = env:: var ( "CARGO_FEATURE_RUSTC_DEP_OF_STD" ) . is_ok ( ) ;
9
+ let align_cargo_feature = env:: var ( "CARGO_FEATURE_ALIGN" ) . is_ok ( ) ;
11
10
12
- if std :: env:: var ( "CARGO_FEATURE_USE_STD" ) . is_ok ( ) {
11
+ if env:: var ( "CARGO_FEATURE_USE_STD" ) . is_ok ( ) {
13
12
println ! (
14
13
"cargo:warning=\" libc's use_std cargo feature is deprecated since libc 0.2.55; \
15
14
please consider using the `std` cargo feature instead\" "
16
15
) ;
17
16
}
18
17
19
- if std :: env:: var ( "LIBC_CI" ) . is_ok ( ) {
18
+ if env:: var ( "LIBC_CI" ) . is_ok ( ) {
20
19
if let Some ( 12 ) = which_freebsd ( ) {
21
20
println ! ( "cargo:rustc-cfg=freebsd12" ) ;
22
21
}
@@ -53,6 +52,11 @@ fn main() {
53
52
if rustc_minor_ver >= 33 || rustc_dep_of_std {
54
53
println ! ( "cargo:rustc-cfg=libc_packedN" ) ;
55
54
}
55
+
56
+ // #[thread_local] is currently unstable
57
+ if rustc_dep_of_std {
58
+ println ! ( "cargo:rustc-cfg=libc_thread_local" ) ;
59
+ }
56
60
}
57
61
58
62
fn rustc_minor_version ( ) -> Option < u32 > {
Original file line number Diff line number Diff line change 21
21
feature = "rustc-dep-of-std" ,
22
22
feature( cfg_target_vendor, link_cfg, no_core)
23
23
) ]
24
+ #![ cfg_attr( libc_thread_local, feature( thread_local) ) ]
24
25
// Enable extra lints:
25
26
#![ cfg_attr( feature = "extra_traits" , deny( missing_debug_implementations) ) ]
26
27
#![ deny( missing_copy_implementations, safe_packed_borrows) ]
Original file line number Diff line number Diff line change
1
+ // DragonFlyBSD's __error function is declared with "static inline", so it must
2
+ // be implemented in the libc crate, as a pointer to a static thread_local.
3
+ f ! {
4
+ pub fn __error( ) -> * mut :: c_int {
5
+ & mut errno
6
+ }
7
+ }
8
+
9
+ extern {
10
+ #[ thread_local]
11
+ pub static mut errno: :: c_int ;
12
+ }
Original file line number Diff line number Diff line change @@ -1060,3 +1060,10 @@ extern {
1060
1060
pub fn fstatfs ( fd : :: c_int , buf : * mut statfs ) -> :: c_int ;
1061
1061
pub fn uname ( buf : * mut :: utsname ) -> :: c_int ;
1062
1062
}
1063
+
1064
+ cfg_if ! {
1065
+ if #[ cfg( libc_thread_local) ] {
1066
+ mod errno;
1067
+ pub use self :: errno:: * ;
1068
+ }
1069
+ }
Original file line number Diff line number Diff line change @@ -1267,6 +1267,7 @@ extern {
1267
1267
pub fn setrlimit ( resource : :: c_int , rlim : * const :: rlimit ) -> :: c_int ;
1268
1268
pub fn strerror_r ( errnum : :: c_int , buf : * mut c_char ,
1269
1269
buflen : :: size_t ) -> :: c_int ;
1270
+ pub fn _errnop ( ) -> * mut :: c_int ;
1270
1271
1271
1272
pub fn abs ( i : :: c_int ) -> :: c_int ;
1272
1273
pub fn atof ( s : * const :: c_char ) -> :: c_double ;
Original file line number Diff line number Diff line change @@ -539,6 +539,7 @@ extern {
539
539
540
540
pub fn strerror_r ( errnum : :: c_int , buf : * mut c_char ,
541
541
buflen : :: size_t ) -> :: c_int ;
542
+ pub fn __errno_location ( ) -> * mut :: c_int ;
542
543
543
544
// malloc.h
544
545
pub fn memalign ( align : :: size_t , size : :: size_t ) -> * mut :: c_void ;
You can’t perform that action at this time.
0 commit comments