]> git.proxmox.com Git - mirror_frr.git/blob - tests/lib/test_sig.c
doc: Add `show ipv6 rpf X:X::X:X` command to docs
[mirror_frr.git] / tests / lib / test_sig.c
1 /*
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 *
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
17 */
18
19 #include <zebra.h>
20 #include <sigevent.h>
21 #include "lib/log.h"
22 #include "lib/memory.h"
23
24 static void sighup(void)
25 {
26 printf("processed hup\n");
27 }
28
29 static void sigusr1(void)
30 {
31 printf("processed usr1\n");
32 }
33
34 static void sigusr2(void)
35 {
36 printf("processed usr2\n");
37 }
38
39 struct frr_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 }};
51
52 struct thread_master *master;
53 struct thread t;
54
55 int main(void)
56 {
57 master = thread_master_create(NULL);
58 signal_init(master, array_size(sigs), sigs);
59
60 zlog_aux_init("NONE: ", LOG_DEBUG);
61
62 while (thread_fetch(master, &t))
63 thread_call(&t);
64
65 exit(0);
66 }