MCPcopy Create free account
hub / github.com/Icinga/icinga2 / UmbrellaSignalHandler

Function UmbrellaSignalHandler

lib/cli/daemoncommand.cpp:369–406  ·  view source on GitHub ↗

* Umbrella process' signal handlers */

Source from the content-addressed store, hash-verified

367 * Umbrella process' signal handlers
368 */
369static void UmbrellaSignalHandler(int num, siginfo_t *info, void*)
370{
371 switch (num) {
372 case SIGUSR1:
373 // Someone requested to re-open logs
374 l_RequestedReopenLogs.store(true);
375 break;
376 case SIGUSR2:
377 if (!l_CurrentlyStartingUnixWorkerReady.load()
378 && (info->si_pid == 0 || info->si_pid == l_CurrentlyStartingUnixWorkerPid.load()) ) {
379 // The seamless worker currently being started by StartUnixWorker() successfully loaded its config
380 l_CurrentlyStartingUnixWorkerReady.store(true);
381 }
382 break;
383 case SIGINT:
384 case SIGTERM:
385 // Someone requested our termination
386
387 {
388 struct sigaction sa;
389 memset(&sa, 0, sizeof(sa));
390
391 sa.sa_handler = SIG_DFL;
392
393 (void)sigaction(num, &sa, nullptr);
394 }
395
396 l_TermSignal.store(num);
397 break;
398 case SIGHUP:
399 // Someone requested to re-load config
400 l_RequestedReload.store(true);
401 break;
402 default:
403 // Programming error (or someone has broken the userspace)
404 VERIFY(!"Caught unexpected signal");
405 }
406}
407
408/**
409 * Seamless worker's signal handlers

Callers

nothing calls this directly

Calls 3

storeMethod · 0.80
loadMethod · 0.80
sigactionClass · 0.70

Tested by

no test coverage detected