| 1042 | } |
| 1043 | |
| 1044 | AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s, |
| 1045 | apr_pool_t *in_pconf) |
| 1046 | { |
| 1047 | #ifndef NO_USE_SIGACTION |
| 1048 | struct sigaction sa; |
| 1049 | |
| 1050 | memset(&sa, 0, sizeof sa); |
| 1051 | sigemptyset(&sa.sa_mask); |
| 1052 | |
| 1053 | #if defined(SA_ONESHOT) |
| 1054 | sa.sa_flags = SA_ONESHOT; |
| 1055 | #elif defined(SA_RESETHAND) |
| 1056 | sa.sa_flags = SA_RESETHAND; |
| 1057 | #endif |
| 1058 | |
| 1059 | sa.sa_handler = sig_coredump; |
| 1060 | if (sigaction(SIGSEGV, &sa, NULL) < 0) |
| 1061 | ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00061) "sigaction(SIGSEGV)"); |
| 1062 | #ifdef SIGBUS |
| 1063 | if (sigaction(SIGBUS, &sa, NULL) < 0) |
| 1064 | ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00062) "sigaction(SIGBUS)"); |
| 1065 | #endif |
| 1066 | #ifdef SIGABORT |
| 1067 | if (sigaction(SIGABORT, &sa, NULL) < 0) |
| 1068 | ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00063) "sigaction(SIGABORT)"); |
| 1069 | #endif |
| 1070 | #ifdef SIGABRT |
| 1071 | if (sigaction(SIGABRT, &sa, NULL) < 0) |
| 1072 | ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00064) "sigaction(SIGABRT)"); |
| 1073 | #endif |
| 1074 | #ifdef SIGILL |
| 1075 | if (sigaction(SIGILL, &sa, NULL) < 0) |
| 1076 | ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00065) "sigaction(SIGILL)"); |
| 1077 | #endif |
| 1078 | #ifdef SIGFPE |
| 1079 | if (sigaction(SIGFPE, &sa, NULL) < 0) |
| 1080 | ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00066) "sigaction(SIGFPE)"); |
| 1081 | #endif |
| 1082 | |
| 1083 | #else /* NO_USE_SIGACTION */ |
| 1084 | |
| 1085 | apr_signal(SIGSEGV, sig_coredump); |
| 1086 | #ifdef SIGBUS |
| 1087 | apr_signal(SIGBUS, sig_coredump); |
| 1088 | #endif /* SIGBUS */ |
| 1089 | #ifdef SIGABORT |
| 1090 | apr_signal(SIGABORT, sig_coredump); |
| 1091 | #endif /* SIGABORT */ |
| 1092 | #ifdef SIGABRT |
| 1093 | apr_signal(SIGABRT, sig_coredump); |
| 1094 | #endif /* SIGABRT */ |
| 1095 | #ifdef SIGILL |
| 1096 | apr_signal(SIGILL, sig_coredump); |
| 1097 | #endif /* SIGILL */ |
| 1098 | #ifdef SIGFPE |
| 1099 | apr_signal(SIGFPE, sig_coredump); |
| 1100 | #endif /* SIGFPE */ |
| 1101 |
no test coverage detected