| 170 | } |
| 171 | |
| 172 | static inline void set_signal_handler( |
| 173 | int signal, void (*handler)(int, siginfo_t*, void*), |
| 174 | struct sigaction* old_sa_ptr) { |
| 175 | struct sigaction sa {}; |
| 176 | sa.sa_sigaction = handler; |
| 177 | sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_NOCLDSTOP | SA_NODEFER; |
| 178 | if (sigemptyset(&sa.sa_mask) != 0 || sigaction(signal, &sa, old_sa_ptr) != 0) { |
| 179 | std::ostringstream oss; |
| 180 | oss << "An error occurred while setting handler for " << strsignal(signal) |
| 181 | << "."; |
| 182 | throw std::runtime_error(oss.str()); |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | SIGNAL_HANDLER( |
| 187 | SIGSEGV, handler_SIGSEGV, |
no test coverage detected