1/* 2 PIM for Quagga 3 Copyright (C) 2008 Everton da Silva Marques 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; see the file COPYING; if not, write to the 17 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 18 MA 02110-1301 USA 19 20 $QuaggaId: $Format:%an, %ai, %h$ $ 21*/ 22 23#include <signal.h> 24 25#include <zebra.h> 26#include "sigevent.h" 27#include "memory.h" 28#include "log.h" 29 30#include "pim_signals.h" 31#include "pimd.h" 32 33/* 34 * Signal handlers 35 */ 36 37static void pim_sighup() 38{ 39 zlog_debug ("SIGHUP received, ignoring"); 40} 41 42static void pim_sigint() 43{ 44 zlog_notice("Terminating on signal SIGINT"); 45 pim_terminate(); 46 exit(1); 47} 48 49static void pim_sigterm() 50{ 51 zlog_notice("Terminating on signal SIGTERM"); 52 pim_terminate(); 53 exit(1); 54} 55 56static void pim_sigusr1() 57{ 58 zlog_debug ("SIGUSR1 received"); 59 zlog_rotate (NULL); 60} 61 62static struct quagga_signal_t pimd_signals[] = 63{ 64 { 65 .signal = SIGHUP, 66 .handler = &pim_sighup, 67 }, 68 { 69 .signal = SIGUSR1, 70 .handler = &pim_sigusr1, 71 }, 72 { 73 .signal = SIGINT, 74 .handler = &pim_sigint, 75 }, 76 { 77 .signal = SIGTERM, 78 .handler = &pim_sigterm, 79 }, 80}; 81 82void pim_signals_init() 83{ 84 signal_init(master, array_size(pimd_signals), pimd_signals); 85} 86 87