@@ -12,7 +12,9 @@ use super::super::offset::{libc_preadv, libc_pwritev};
12
12
#[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
13
13
use super :: super :: offset:: { libc_preadv2, libc_pwritev2} ;
14
14
use crate :: fd:: { AsFd , BorrowedFd , OwnedFd , RawFd } ;
15
- #[ cfg( any( target_os = "solaris" , target_os = "illumos" ) ) ]
15
+ #[ cfg( bsd) ]
16
+ use crate :: io:: kqueue:: Event ;
17
+ #[ cfg( solarish) ]
16
18
use crate :: io:: port:: Event ;
17
19
#[ cfg( not( any( target_os = "aix" , target_os = "wasi" ) ) ) ]
18
20
use crate :: io:: DupFlags ;
@@ -29,18 +31,6 @@ use core::ptr;
29
31
#[ cfg( all( feature = "fs" , feature = "net" ) ) ]
30
32
use libc_errno:: errno;
31
33
32
- #[ cfg( any(
33
- target_os = "macos" ,
34
- target_os = "ios" ,
35
- target_os = "tvos" ,
36
- target_os = "watchos" ,
37
- target_os = "freebsd" ,
38
- target_os = "dragonfly" ,
39
- target_os = "openbsd" ,
40
- target_os = "netbsd"
41
- ) ) ]
42
- use crate :: io:: kqueue:: Event ;
43
-
44
34
pub ( crate ) fn read ( fd : BorrowedFd < ' _ > , buf : & mut [ u8 ] ) -> io:: Result < usize > {
45
35
let nread = unsafe {
46
36
ret_ssize_t ( c:: read (
@@ -464,30 +454,12 @@ pub(crate) fn ioctl_tiocnxcl(fd: BorrowedFd) -> io::Result<()> {
464
454
unsafe { ret ( c:: ioctl ( borrowed_fd ( fd) , c:: TIOCNXCL as _ ) ) }
465
455
}
466
456
467
- #[ cfg( any(
468
- target_os = "macos" ,
469
- target_os = "ios" ,
470
- target_os = "tvos" ,
471
- target_os = "watchos" ,
472
- target_os = "freebsd" ,
473
- target_os = "dragonfly" ,
474
- target_os = "openbsd" ,
475
- target_os = "netbsd"
476
- ) ) ]
457
+ #[ cfg( bsd) ]
477
458
pub ( crate ) fn kqueue ( ) -> io:: Result < OwnedFd > {
478
459
unsafe { ret_owned_fd ( c:: kqueue ( ) ) }
479
460
}
480
461
481
- #[ cfg( any(
482
- target_os = "macos" ,
483
- target_os = "ios" ,
484
- target_os = "tvos" ,
485
- target_os = "watchos" ,
486
- target_os = "freebsd" ,
487
- target_os = "dragonfly" ,
488
- target_os = "openbsd" ,
489
- target_os = "netbsd"
490
- ) ) ]
462
+ #[ cfg( bsd) ]
491
463
pub ( crate ) unsafe fn kevent (
492
464
kq : BorrowedFd < ' _ > ,
493
465
changelist : & [ Event ] ,
@@ -582,12 +554,12 @@ pub unsafe fn vmsplice(
582
554
. map ( |spliced| spliced as usize )
583
555
}
584
556
585
- #[ cfg( any ( target_os = "illumos" , target_os = "solaris" ) ) ]
557
+ #[ cfg( solarish ) ]
586
558
pub ( crate ) fn port_create ( ) -> io:: Result < OwnedFd > {
587
559
unsafe { ret_owned_fd ( c:: port_create ( ) ) }
588
560
}
589
561
590
- #[ cfg( any ( target_os = "illumos" , target_os = "solaris" ) ) ]
562
+ #[ cfg( solarish ) ]
591
563
pub ( crate ) unsafe fn port_associate (
592
564
port : BorrowedFd < ' _ > ,
593
565
source : c:: c_int ,
@@ -604,7 +576,7 @@ pub(crate) unsafe fn port_associate(
604
576
) )
605
577
}
606
578
607
- #[ cfg( any ( target_os = "illumos" , target_os = "solaris" ) ) ]
579
+ #[ cfg( solarish ) ]
608
580
pub ( crate ) unsafe fn port_dissociate (
609
581
port : BorrowedFd < ' _ > ,
610
582
source : c:: c_int ,
@@ -613,7 +585,7 @@ pub(crate) unsafe fn port_dissociate(
613
585
ret ( c:: port_dissociate ( borrowed_fd ( port) , source, object) )
614
586
}
615
587
616
- #[ cfg( any ( target_os = "illumos" , target_os = "solaris" ) ) ]
588
+ #[ cfg( solarish ) ]
617
589
pub ( crate ) fn port_get (
618
590
port : BorrowedFd < ' _ > ,
619
591
timeout : Option < & mut c:: timespec > ,
@@ -629,7 +601,7 @@ pub(crate) fn port_get(
629
601
Ok ( Event ( unsafe { event. assume_init ( ) } ) )
630
602
}
631
603
632
- #[ cfg( any ( target_os = "illumos" , target_os = "solaris" ) ) ]
604
+ #[ cfg( solarish ) ]
633
605
pub ( crate ) fn port_getn (
634
606
port : BorrowedFd < ' _ > ,
635
607
timeout : Option < & mut c:: timespec > ,
@@ -655,7 +627,7 @@ pub(crate) fn port_getn(
655
627
Ok ( ( ) )
656
628
}
657
629
658
- #[ cfg( any ( target_os = "illumos" , target_os = "solaris" ) ) ]
630
+ #[ cfg( solarish ) ]
659
631
pub ( crate ) fn port_send (
660
632
port : BorrowedFd < ' _ > ,
661
633
events : c:: c_int ,
0 commit comments