]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_signals.c
pimd: Apparently compilers are evil
[mirror_frr.git] / pimd / pim_signals.c
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 <zebra.h>
24
25 #include <signal.h>
26
27 #include "sigevent.h"
28 #include "memory.h"
29 #include "log.h"
30 #include "if.h"
31
32 #include "pim_signals.h"
33 #include "pimd.h"
34
35 /*
36 * Signal handlers
37 */
38
39 static void pim_sighup()
40 {
41 zlog_info ("SIGHUP received, ignoring");
42 }
43
44 static void pim_sigint()
45 {
46 zlog_notice("Terminating on signal SIGINT");
47 pim_terminate();
48 exit(1);
49 }
50
51 static void pim_sigterm()
52 {
53 zlog_notice("Terminating on signal SIGTERM");
54 pim_terminate();
55 exit(1);
56 }
57
58 static void pim_sigusr1()
59 {
60 zlog_info ("SIGUSR1 received");
61 zlog_rotate (NULL);
62 }
63
64 static struct quagga_signal_t pimd_signals[] =
65 {
66 {
67 .signal = SIGHUP,
68 .handler = &pim_sighup,
69 },
70 {
71 .signal = SIGUSR1,
72 .handler = &pim_sigusr1,
73 },
74 {
75 .signal = SIGINT,
76 .handler = &pim_sigint,
77 },
78 {
79 .signal = SIGTERM,
80 .handler = &pim_sigterm,
81 },
82 };
83
84 void pim_signals_init()
85 {
86 signal_init(master, array_size(pimd_signals), pimd_signals);
87 }
88