blob: df023fac60a151c35468705e36bdcd2d4b3599ed [file] [log] [blame]
paul9a76e2d2004-01-19 21:25:17 +00001#include <zebra.h>
2#include <sigevent.h>
Paul Jakma1602a712006-05-28 08:32:44 +00003#include "lib/log.h"
David Lamparter326fe3d2012-11-03 09:13:23 -07004#include "lib/memory.h"
paul9a76e2d2004-01-19 21:25:17 +00005
6void
7sighup (void)
8{
9 printf ("processed hup\n");
10}
11
12void
13sigusr1 (void)
14{
15 printf ("processed usr1\n");
16}
17
18void
19sigusr2 (void)
20{
21 printf ("processed usr2\n");
22}
23
24struct quagga_signal_t sigs[] =
25{
26 {
27 .signal = SIGHUP,
28 .handler = &sighup,
29 },
30 {
31 .signal = SIGUSR1,
32 .handler = &sigusr1,
33 },
34 {
35 .signal = SIGUSR2,
36 .handler = &sigusr2,
37 }
38};
39
40struct thread_master *master;
41struct thread t;
42
43int
44main (void)
45{
46 master = thread_master_create ();
Balaji.G837d16c2012-09-26 14:09:10 +053047 signal_init (master, array_size(sigs), sigs);
Paul Jakmaf783c1d2006-05-28 08:31:17 +000048
49 zlog_default = openzlog("testsig", ZLOG_NONE,
50 LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
51 zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
52 zlog_set_level (NULL, ZLOG_DEST_STDOUT, LOG_DEBUG);
53 zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED);
54
paul9a76e2d2004-01-19 21:25:17 +000055 while (thread_fetch (master, &t))
56 thread_call (&t);
57
58 exit (0);
59}