26 #include <sys/socket.h> 30 #include <QSocketNotifier> 36 if (socketpair(AF_UNIX, SOCK_STREAM, 0,
sockets_) != 0)
39 struct sigaction sig_action;
42 sigemptyset(&sig_action.sa_mask);
43 sig_action.sa_flags = SA_RESTART;
45 if (sigaction(SIGINT, &sig_action,
nullptr) != 0 ||
46 sigaction(SIGTERM, &sig_action,
nullptr) != 0 ||
47 sigaction(SIGUSR1, &sig_action,
nullptr) != 0) {
60 QSocketNotifier::Read,
this);
70 if (read(
sockets_[1], &sig_number,
sizeof(
int)) !=
sizeof(
int)) {
71 qDebug() <<
"Failed to catch signal";
92 if (write(
sockets_[0], &sig_number,
sizeof(
int)) !=
sizeof(
int)) {
QSocketNotifier * socket_notifier_
static void handle_signals(int sig_number)
SignalHandler(QObject *parent=nullptr)
static bool prepare_signals()
void on_socket_notifier_activated()