@@ -670,21 +670,12 @@ impl SigAction {
670
670
/// is the `SigAction` variant). `mask` specifies other signals to block during execution of
671
671
/// the signal-catching function.
672
672
pub fn new( handler: SigHandler , flags: SaFlags , mask: SigSet ) -> SigAction {
673
- #[ cfg( target_os = "redox" ) ]
674
- unsafe fn install_sig( p: * mut libc:: sigaction, handler: SigHandler ) {
675
- ( * p) . sa_handler = match handler {
676
- SigHandler :: SigDfl => libc:: SIG_DFL ,
677
- SigHandler :: SigIgn => libc:: SIG_IGN ,
678
- SigHandler :: Handler ( f) => f as * const extern fn ( libc:: c_int) as usize ,
679
- } ;
680
- }
681
-
682
- #[ cfg( not( target_os = "redox" ) ) ]
683
673
unsafe fn install_sig( p: * mut libc:: sigaction, handler: SigHandler ) {
684
674
( * p) . sa_sigaction = match handler {
685
675
SigHandler :: SigDfl => libc:: SIG_DFL ,
686
676
SigHandler :: SigIgn => libc:: SIG_IGN ,
687
677
SigHandler :: Handler ( f) => f as * const extern fn ( libc:: c_int) as usize ,
678
+ #[ cfg( not( target_os = "redox" ) ) ]
688
679
SigHandler :: SigAction ( f) => f as * const extern fn ( libc:: c_int, * mut libc:: siginfo_t, * mut libc:: c_void) as usize ,
689
680
} ;
690
681
}
@@ -716,12 +707,11 @@ impl SigAction {
716
707
}
717
708
718
709
/// Returns the action's handler.
719
- #[ cfg( not( target_os = "redox" ) ) ]
720
- #[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
721
710
pub fn handler( & self ) -> SigHandler {
722
711
match self . sigaction. sa_sigaction {
723
712
libc:: SIG_DFL => SigHandler :: SigDfl ,
724
713
libc:: SIG_IGN => SigHandler :: SigIgn ,
714
+ #[ cfg( not( target_os = "redox" ) ) ]
725
715
p if self . flags( ) . contains( SaFlags :: SA_SIGINFO ) =>
726
716
SigHandler :: SigAction (
727
717
// Safe for one of two reasons:
@@ -749,28 +739,6 @@ impl SigAction {
749
739
as extern fn ( libc:: c_int) ) ,
750
740
}
751
741
}
752
-
753
- /// Returns the action's handler.
754
- #[ cfg( target_os = "redox" ) ]
755
- #[ cfg_attr( docsrs, doc( cfg( all( ) ) ) ) ]
756
- pub fn handler( & self ) -> SigHandler {
757
- match self . sigaction. sa_handler {
758
- libc:: SIG_DFL => SigHandler :: SigDfl ,
759
- libc:: SIG_IGN => SigHandler :: SigIgn ,
760
- p => SigHandler :: Handler (
761
- // Safe for one of two reasons:
762
- // * The SigHandler was created by SigHandler::new, in which
763
- // case the pointer is correct, or
764
- // * The SigHandler was created by signal or sigaction, which
765
- // are unsafe functions, so the caller should've somehow
766
- // ensured that it is correctly initialized.
767
- unsafe {
768
- * ( & p as * const usize
769
- as * const extern fn ( libc:: c_int) )
770
- }
771
- as extern fn ( libc:: c_int) ) ,
772
- }
773
- }
774
742
}
775
743
776
744
/// Changes the action taken by a process on receipt of a specific signal.
0 commit comments