]>
Commit | Line | Data |
---|---|---|
46f4a4d2 PJ |
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 | * | |
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 | |
9fc3f9b3 | 24 | static void |
9a76e2dd | 25 | sighup (void) |
26 | { | |
27 | printf ("processed hup\n"); | |
28 | } | |
29 | ||
9fc3f9b3 | 30 | static void |
9a76e2dd | 31 | sigusr1 (void) |
32 | { | |
33 | printf ("processed usr1\n"); | |
34 | } | |
35 | ||
9fc3f9b3 | 36 | static void |
9a76e2dd | 37 | sigusr2 (void) |
38 | { | |
39 | printf ("processed usr2\n"); | |
40 | } | |
41 | ||
42 | struct quagga_signal_t sigs[] = | |
43 | { | |
44 | { | |
45 | .signal = SIGHUP, | |
46 | .handler = &sighup, | |
47 | }, | |
48 | { | |
49 | .signal = SIGUSR1, | |
50 | .handler = &sigusr1, | |
51 | }, | |
52 | { | |
53 | .signal = SIGUSR2, | |
54 | .handler = &sigusr2, | |
55 | } | |
56 | }; | |
57 | ||
58 | struct thread_master *master; | |
59 | struct thread t; | |
60 | ||
61 | int | |
62 | main (void) | |
63 | { | |
64 | master = thread_master_create (); | |
837d16cc | 65 | signal_init (master, array_size(sigs), sigs); |
bf1013e6 DL |
66 | |
67 | openzlog("testsig", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON); | |
dd8376fe DL |
68 | zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED); |
69 | zlog_set_level(ZLOG_DEST_STDOUT, LOG_DEBUG); | |
70 | zlog_set_level(ZLOG_DEST_MONITOR, ZLOG_DISABLED); | |
71 | ||
9a76e2dd | 72 | while (thread_fetch (master, &t)) |
73 | thread_call (&t); | |
74 | ||
75 | exit (0); | |
76 | } |