-/**
- * Initialize the signal handler.
- */
-static void
-Initialize_Signal_Handler( void )
-{
-#ifdef HAVE_SIGACTION
- struct sigaction saction;
-
- memset( &saction, 0, sizeof( saction ));
- saction.sa_handler = Signal_Handler;
-#ifdef SA_RESTART
- saction.sa_flags |= SA_RESTART;
-#endif
-#ifdef SA_NOCLDWAIT
- saction.sa_flags |= SA_NOCLDWAIT;
-#endif
-
- sigaction(SIGINT, &saction, NULL);
- sigaction(SIGQUIT, &saction, NULL);
- sigaction(SIGTERM, &saction, NULL);
- sigaction(SIGHUP, &saction, NULL);
- sigaction(SIGCHLD, &saction, NULL);
-
- /* we handle write errors properly; ignore SIGPIPE */
- saction.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &saction, NULL);
-#else
- signal(SIGINT, Signal_Handler);
- signal(SIGQUIT, Signal_Handler);
- signal(SIGTERM, Signal_Handler);
- signal(SIGHUP, Signal_Handler);
- signal(SIGCHLD, Signal_Handler);
-
- signal(SIGPIPE, SIG_IGN);
-#endif
-} /* Initialize_Signal_Handler */
-
-
-/**
- * Signal handler of ngIRCd.
- * This function is called whenever ngIRCd catches a signal sent by the
- * user and/or the system to it. For example SIGTERM and SIGHUP.
- * @param Signal Number of the signal to handle.
- */
-static void
-Signal_Handler( int Signal )
-{
- switch( Signal )
- {
- case SIGTERM:
- case SIGINT:
- case SIGQUIT:
- /* shut down sever */
- NGIRCd_SignalQuit = true;
- break;
- case SIGHUP:
- /* re-read configuration */
- NGIRCd_SignalRehash = true;
- break;
- case SIGCHLD:
- /* child-process exited, avoid zombies */
- while (waitpid( -1, NULL, WNOHANG) > 0)
- ;
- break;
-#ifdef DEBUG
- default:
- /* unbekanntes bzw. unbehandeltes Signal */
- Log( LOG_DEBUG, "Got signal %d! Ignored.", Signal );
-#endif
- }
-} /* Signal_Handler */
-
-