MCPcopy Index your code
hub / github.com/RustPython/RustPython / faulthandler_user_signal

Function faulthandler_user_signal

crates/stdlib/src/faulthandler.rs:1053–1082  ·  view source on GitHub ↗
(signum: libc::c_int)

Source from the content-addressed store, hash-verified

1051
1052 #[cfg(unix)]
1053 extern "C" fn faulthandler_user_signal(signum: libc::c_int) {
1054 let save_errno = get_errno();
1055
1056 let user = match user_signals::get_user_signal(signum as usize) {
1057 Some(u) if u.enabled => u,
1058 _ => return,
1059 };
1060
1061 faulthandler_dump_traceback(user.fd, user.all_threads);
1062
1063 if user.chain {
1064 // Restore the previous handler and re-raise
1065 unsafe {
1066 libc::sigaction(signum, &user.previous, core::ptr::null_mut());
1067 }
1068 set_errno(save_errno);
1069 unsafe {
1070 libc::raise(signum);
1071 }
1072 // Re-install our handler with the same flags as register()
1073 let save_errno2 = get_errno();
1074 unsafe {
1075 let mut action: libc::sigaction = core::mem::zeroed();
1076 action.sa_sigaction = faulthandler_user_signal as *const () as libc::sighandler_t;
1077 action.sa_flags = libc::SA_NODEFER;
1078 libc::sigaction(signum, &action, core::ptr::null_mut());
1079 }
1080 set_errno(save_errno2);
1081 }
1082 }
1083
1084 #[cfg(unix)]
1085 fn check_signum(signum: i32, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 4

get_user_signalFunction · 0.85
get_errnoFunction · 0.50
set_errnoFunction · 0.50

Tested by

no test coverage detected