]> git.proxmox.com Git - mirror_frr.git/blame - tests/lib/test_sig.c
Merge pull request #6025 from patrasar/rp-info-igmp-group-json-fix
[mirror_frr.git] / tests / lib / test_sig.c
CommitLineData
d62a17ae 1/*
46f4a4d2
PJ
2 * This file is part of Quagga.
3 *
4 * Quagga is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
7 * later version.
8 *
9 * Quagga is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
896014f4
DL
14 * You should have received a copy of the GNU General Public License along
15 * with this program; see the file COPYING; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
46f4a4d2
PJ
17 */
18
9a76e2dd 19#include <zebra.h>
20#include <sigevent.h>
1602a71d 21#include "lib/log.h"
326fe3df 22#include "lib/memory.h"
9a76e2dd 23
d62a17ae 24static void sighup(void)
9a76e2dd 25{
d62a17ae 26 printf("processed hup\n");
9a76e2dd 27}
28
d62a17ae 29static void sigusr1(void)
9a76e2dd 30{
d62a17ae 31 printf("processed usr1\n");
9a76e2dd 32}
33
d62a17ae 34static void sigusr2(void)
9a76e2dd 35{
d62a17ae 36 printf("processed usr2\n");
9a76e2dd 37}
38
d62a17ae 39struct quagga_signal_t sigs[] = {{
40 .signal = SIGHUP,
41 .handler = &sighup,
42 },
43 {
44 .signal = SIGUSR1,
45 .handler = &sigusr1,
46 },
47 {
48 .signal = SIGUSR2,
49 .handler = &sigusr2,
50 }};
9a76e2dd 51
52struct thread_master *master;
53struct thread t;
54
d62a17ae 55int main(void)
9a76e2dd 56{
d62a17ae 57 master = thread_master_create(NULL);
58 signal_init(master, array_size(sigs), sigs);
bf1013e6 59
0bdeb5e5 60 zlog_aux_init("NONE: ", LOG_DEBUG);
dd8376fe 61
d62a17ae 62 while (thread_fetch(master, &t))
63 thread_call(&t);
9a76e2dd 64
d62a17ae 65 exit(0);
9a76e2dd 66}