@@ -757,11 +757,11 @@ pub enum SigHandler {
757
757
/// Request that the signal be ignored.
758
758
SigIgn ,
759
759
/// Use the given signal-catching function, which takes in the signal.
760
- Handler ( extern fn ( libc:: c_int) ) ,
760
+ Handler ( extern "C" fn ( libc:: c_int) ) ,
761
761
/// Use the given signal-catching function, which takes in the signal, information about how
762
762
/// the signal was generated, and a pointer to the threads `ucontext_t`.
763
763
#[ cfg( not( target_os = "redox" ) ) ]
764
- SigAction ( extern fn ( libc:: c_int, * mut libc:: siginfo_t, * mut libc:: c_void) )
764
+ SigAction ( extern "C" fn ( libc:: c_int, * mut libc:: siginfo_t, * mut libc:: c_void) )
765
765
}
766
766
767
767
/// Action to take on receipt of a signal. Corresponds to `sigaction`.
@@ -790,9 +790,9 @@ impl SigAction {
790
790
( * p) . sa_sigaction = match handler {
791
791
SigHandler :: SigDfl => libc:: SIG_DFL ,
792
792
SigHandler :: SigIgn => libc:: SIG_IGN ,
793
- SigHandler :: Handler ( f) => f as * const extern fn ( libc:: c_int) as usize ,
793
+ SigHandler :: Handler ( f) => f as * const extern "C" fn ( libc:: c_int) as usize ,
794
794
#[ cfg( not( target_os = "redox" ) ) ]
795
- SigHandler :: SigAction ( f) => f as * const extern fn ( libc:: c_int, * mut libc:: siginfo_t, * mut libc:: c_void) as usize ,
795
+ SigHandler :: SigAction ( f) => f as * const extern "C" fn ( libc:: c_int, * mut libc:: siginfo_t, * mut libc:: c_void) as usize ,
796
796
} ;
797
797
}
798
798
}
@@ -852,9 +852,9 @@ impl SigAction {
852
852
// ensured that it is correctly initialized.
853
853
unsafe {
854
854
* ( & p as * const usize
855
- as * const extern fn ( _, _, _) )
855
+ as * const extern "C" fn ( _, _, _) )
856
856
}
857
- as extern fn ( _, _, _) ) ,
857
+ as extern "C" fn ( _, _, _) ) ,
858
858
p => SigHandler :: Handler (
859
859
// Safe for one of two reasons:
860
860
// * The SigHandler was created by SigHandler::new, in which
@@ -864,9 +864,9 @@ impl SigAction {
864
864
// ensured that it is correctly initialized.
865
865
unsafe {
866
866
* ( & p as * const usize
867
- as * const extern fn ( libc:: c_int) )
867
+ as * const extern "C" fn ( libc:: c_int) )
868
868
}
869
- as extern fn ( libc:: c_int) ) ,
869
+ as extern "C" fn ( libc:: c_int) ) ,
870
870
}
871
871
}
872
872
@@ -880,12 +880,12 @@ impl SigAction {
880
880
p if self . flags( ) . contains( SaFlags :: SA_SIGINFO ) =>
881
881
SigHandler :: SigAction (
882
882
* ( & p as * const usize
883
- as * const extern fn ( _, _, _) )
884
- as extern fn ( _, _, _) ) ,
883
+ as * const extern "C" fn ( _, _, _) )
884
+ as extern "C" fn ( _, _, _) ) ,
885
885
p => SigHandler :: Handler (
886
886
* ( & p as * const usize
887
- as * const extern fn ( libc:: c_int) )
888
- as extern fn ( libc:: c_int) ) ,
887
+ as * const extern "C" fn ( libc:: c_int) )
888
+ as extern "C" fn ( libc:: c_int) ) ,
889
889
}
890
890
}
891
891
}
@@ -947,7 +947,7 @@ pub unsafe fn sigaction(signal: Signal, sigaction: &SigAction) -> Result<SigActi
947
947
/// # use nix::sys::signal::{self, Signal, SigHandler};
948
948
/// static SIGNALED: AtomicBool = AtomicBool::new(false);
949
949
///
950
- /// extern fn handle_sigint(signal: libc::c_int) {
950
+ /// extern "C" fn handle_sigint(signal: libc::c_int) {
951
951
/// let signal = Signal::try_from(signal).unwrap();
952
952
/// SIGNALED.store(signal == Signal::SIGINT, Ordering::Relaxed);
953
953
/// }
@@ -984,7 +984,7 @@ pub unsafe fn signal(signal: Signal, handler: SigHandler) -> Result<SigHandler>
984
984
libc:: SIG_DFL => SigHandler :: SigDfl ,
985
985
libc:: SIG_IGN => SigHandler :: SigIgn ,
986
986
p => SigHandler :: Handler (
987
- unsafe { * ( & p as * const usize as * const extern fn ( libc:: c_int) ) } as extern fn ( libc:: c_int) ) ,
987
+ unsafe { * ( & p as * const usize as * const extern "C" fn ( libc:: c_int) ) } as extern "C" fn ( libc:: c_int) ) ,
988
988
}
989
989
} )
990
990
}
0 commit comments