mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 21:52:30 +00:00
* Added better handling of SIGBUS, including the error type and fault address in the dump.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1247 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -36,7 +36,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdexcept>
|
||||
#include "rak/error_number.h"
|
||||
#include "signal_handler.h"
|
||||
|
||||
SignalHandler::Slot SignalHandler::m_handlers[HIGHEST_SIGNAL];
|
||||
@@ -71,6 +73,20 @@ SignalHandler::set_handler(unsigned int signum, Slot slot) {
|
||||
m_handlers[signum] = slot;
|
||||
}
|
||||
|
||||
void
|
||||
SignalHandler::set_sigaction_handler(unsigned int signum, handler_slot slot) {
|
||||
if (signum > HIGHEST_SIGNAL)
|
||||
throw std::logic_error("SignalHandler::set_handler(...) received invalid signal value.");
|
||||
|
||||
struct sigaction sa;
|
||||
sa.sa_sigaction = slot;
|
||||
sa.sa_mask = 0;
|
||||
sa.sa_flags = SA_SIGINFO;
|
||||
|
||||
if (sigaction(signum, &sa, NULL) == -1)
|
||||
throw std::logic_error("Could not set sigaction: " + std::string(rak::error_number::current().c_str()));
|
||||
}
|
||||
|
||||
void
|
||||
SignalHandler::caught(int signum) {
|
||||
if ((unsigned)signum > HIGHEST_SIGNAL)
|
||||
|
||||
Reference in New Issue
Block a user