MCPcopy Create free account
hub / github.com/codestation/qcma / setup_handlers

Function setup_handlers

cli/main_cli.cpp:60–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60static bool setup_handlers()
61{
62 struct sigaction hup, term;
63
64 memset(&hup, 0, sizeof(hup));
65 memset(&term, 0, sizeof(term));
66
67 hup.sa_handler = HeadlessManager::hupSignalHandler;
68 sigemptyset(&hup.sa_mask);
69 hup.sa_flags = 0;
70 hup.sa_flags |= SA_RESTART;
71
72 if (sigaction(SIGHUP, &hup, NULL) != 0) {
73 qCritical("SIGHUP signal handle failed");
74 return false;
75 }
76
77 term.sa_handler = HeadlessManager::termSignalHandler;
78 sigemptyset(&term.sa_mask);
79 term.sa_flags |= SA_RESTART;
80
81 if (sigaction(SIGTERM, &term, NULL) != 0) {
82 qCritical("SIGTERM signal handle failed");
83 return false;
84 }
85
86 if (sigaction(SIGINT, &term, NULL) != 0) {
87 qCritical("SIGINT signal handle failed");
88 return false;
89 }
90
91 return true;
92}
93
94int main(int argc, char *argv[])
95{

Callers 1

mainFunction · 0.70

Calls 1

sigactionClass · 0.70

Tested by

no test coverage detected