@@ -15,10 +15,15 @@ pub type off_t = i64;
15
15
pub type pthread_t = :: c_ulong ;
16
16
pub type pthread_key_t = :: c_uint ;
17
17
pub type rlim_t = u32 ;
18
- #[ cfg( not( target_os = "horizon" ) ) ]
19
- pub type sa_family_t = u8 ;
20
- #[ cfg( target_os = "horizon" ) ]
21
- pub type sa_family_t = u16 ;
18
+
19
+ cfg_if ! {
20
+ if #[ cfg( target_os = "horizon" ) ] {
21
+ pub type sa_family_t = u16 ;
22
+ } else {
23
+ pub type sa_family_t = u8 ;
24
+ }
25
+ }
26
+
22
27
pub type socklen_t = u32 ;
23
28
pub type speed_t = u32 ;
24
29
pub type suseconds_t = i32 ;
@@ -480,10 +485,13 @@ pub const SO_SNDLOWAT: ::c_int = 0x1003;
480
485
pub const SO_RCVLOWAT : :: c_int = 0x1004 ;
481
486
pub const SO_SNDTIMEO : :: c_int = 0x1005 ;
482
487
pub const SO_RCVTIMEO : :: c_int = 0x1006 ;
483
- #[ cfg( not( target_os = "horizon" ) ) ]
484
- pub const SO_ERROR : :: c_int = 0x1007 ;
485
- #[ cfg( target_os = "horizon" ) ]
486
- pub const SO_ERROR : :: c_int = 0x1009 ;
488
+ cfg_if ! {
489
+ if #[ cfg( target_os = "horizon" ) ] {
490
+ pub const SO_ERROR : :: c_int = 0x1009 ;
491
+ } else {
492
+ pub const SO_ERROR : :: c_int = 0x1007 ;
493
+ }
494
+ }
487
495
pub const SO_TYPE : :: c_int = 0x1008 ;
488
496
489
497
pub const SOCK_CLOEXEC : :: c_int = O_CLOEXEC ;
@@ -518,10 +526,13 @@ pub const TCP_KEEPIDLE: ::c_int = 256;
518
526
pub const TCP_KEEPINTVL : :: c_int = 512 ;
519
527
pub const TCP_KEEPCNT : :: c_int = 1024 ;
520
528
521
- #[ cfg( not( target_os = "horizon" ) ) ]
522
- pub const IP_TOS : :: c_int = 3 ;
523
- #[ cfg( target_os = "horizon" ) ]
524
- pub const IP_TOS : :: c_int = 7 ;
529
+ cfg_if ! {
530
+ if #[ cfg( target_os = "horizon" ) ] {
531
+ pub const IP_TOS : :: c_int = 7 ;
532
+ } else {
533
+ pub const IP_TOS : :: c_int = 3 ;
534
+ }
535
+ }
525
536
pub const IP_TTL : :: c_int = 8 ;
526
537
pub const IP_MULTICAST_IF : :: c_int = 9 ;
527
538
pub const IP_MULTICAST_TTL : :: c_int = 10 ;
0 commit comments