]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_signals.c
Merge pull request #32 from qlyoung/fix-cli-nits2
[mirror_frr.git] / pimd / pim_signals.c
CommitLineData
12e41d03
DL
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
12e41d03
DL
19*/
20
7a2fbbf0
DL
21#include <zebra.h>
22
12e41d03
DL
23#include <signal.h>
24
12e41d03
DL
25#include "sigevent.h"
26#include "memory.h"
27#include "log.h"
9df99407 28#include "if.h"
12e41d03
DL
29
30#include "pim_signals.h"
31#include "pimd.h"
32
33/*
34 * Signal handlers
35 */
36
37static void pim_sighup()
38{
7adf0260 39 zlog_info ("SIGHUP received, ignoring");
12e41d03
DL
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{
12e41d03
DL
58 zlog_rotate (NULL);
59}
60
61static struct quagga_signal_t pimd_signals[] =
62{
63 {
64 .signal = SIGHUP,
65 .handler = &pim_sighup,
66 },
67 {
68 .signal = SIGUSR1,
69 .handler = &pim_sigusr1,
70 },
71 {
72 .signal = SIGINT,
73 .handler = &pim_sigint,
74 },
75 {
76 .signal = SIGTERM,
77 .handler = &pim_sigterm,
78 },
79};
80
81void pim_signals_init()
82{
83 signal_init(master, array_size(pimd_signals), pimd_signals);
84}
85