File tree 3 files changed +48
-1
lines changed
src/unix/bsd/netbsdlike/netbsd
3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
29
29
"libc_thread_local" ,
30
30
"libc_underscore_const_names" ,
31
31
"libc_union" ,
32
+ "netbsd10" ,
32
33
] ;
33
34
34
35
// Extra values to allow for check-cfg.
@@ -73,6 +74,12 @@ fn main() {
73
74
Some ( _) | None => set_cfg ( "freebsd11" ) ,
74
75
}
75
76
77
+ match which_netbsd ( ) {
78
+ // TODO: to update if there is a api breaking change
79
+ Some ( 10 ..=99 ) => set_cfg ( "netbsd10" ) ,
80
+ Some ( _) | None => ( ) ,
81
+ }
82
+
76
83
match emcc_version_code ( ) {
77
84
Some ( v) if ( v >= 30142 ) => set_cfg ( "emscripten_new_stat_abi" ) ,
78
85
// Non-Emscripten or version < 3.1.42.
@@ -256,6 +263,21 @@ fn which_freebsd() -> Option<i32> {
256
263
}
257
264
}
258
265
266
+ fn which_netbsd ( ) -> Option < i32 > {
267
+ let output = std:: process:: Command :: new ( "uname" ) . arg ( "-r" ) . output ( ) . ok ( ) ;
268
+ if output. is_none ( ) {
269
+ return None ;
270
+ }
271
+
272
+ let output = output. unwrap ( ) ;
273
+ let stdout = String :: from_utf8 ( output. stdout ) . ok ( ) . unwrap ( ) ;
274
+
275
+ match & stdout {
276
+ s if s. starts_with ( "10" ) => Some ( 10 ) ,
277
+ _ => None ,
278
+ }
279
+ }
280
+
259
281
fn emcc_version_code ( ) -> Option < u64 > {
260
282
let output = std:: process:: Command :: new ( "emcc" )
261
283
. arg ( "-dumpversion" )
Original file line number Diff line number Diff line change @@ -1037,6 +1037,13 @@ fn test_netbsd(target: &str) {
1037
1037
assert ! ( target. contains( "netbsd" ) ) ;
1038
1038
let mut cfg = ctest_cfg ( ) ;
1039
1039
1040
+ let netbsd_ver = which_netbsd ( ) ;
1041
+
1042
+ match netbsd_ver {
1043
+ Some ( 10 ..=99 ) => cfg. cfg ( "netbsd10" , None ) ,
1044
+ _ => & mut cfg,
1045
+ } ;
1046
+
1040
1047
cfg. flag ( "-Wno-deprecated-declarations" ) ;
1041
1048
cfg. define ( "_NETBSD_SOURCE" , Some ( "1" ) ) ;
1042
1049
@@ -4458,6 +4465,21 @@ fn which_freebsd() -> Option<i32> {
4458
4465
}
4459
4466
}
4460
4467
4468
+ fn which_netbsd ( ) -> Option < i32 > {
4469
+ let output = std:: process:: Command :: new ( "uname" ) . arg ( "-r" ) . output ( ) . ok ( ) ;
4470
+ if output. is_none ( ) {
4471
+ return None ;
4472
+ }
4473
+
4474
+ let output = output. unwrap ( ) ;
4475
+ let stdout = String :: from_utf8 ( output. stdout ) . ok ( ) . unwrap ( ) ;
4476
+
4477
+ match & stdout {
4478
+ s if s. starts_with ( "10" ) => Some ( 10 ) ,
4479
+ _ => None ,
4480
+ }
4481
+ }
4482
+
4461
4483
fn test_haiku ( target : & str ) {
4462
4484
assert ! ( target. contains( "haiku" ) ) ;
4463
4485
Original file line number Diff line number Diff line change @@ -286,7 +286,10 @@ s! {
286
286
pub flags: u32 ,
287
287
pub fflags: u32 ,
288
288
pub data: i64 ,
289
- pub udata: :: intptr_t, /* FIXME: NetBSD 10.0 will finally have same layout as other BSD */
289
+ #[ cfg( netbsd10) ]
290
+ pub udata: * mut :: c_void,
291
+ #[ cfg( not( netbsd10) ) ]
292
+ pub udata: :: intptr_t,
290
293
}
291
294
292
295
pub struct dqblk {
You can’t perform that action at this time.
0 commit comments