blob: 63aab6f0b46a9477b0b5cc9c898e44a827b22a21 [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"
paul9a76e2d2004-01-19 21:25:17 +00004
5void
6sighup (void)
7{
8 printf ("processed hup\n");
9}
10
11void
12sigusr1 (void)
13{
14 printf ("processed usr1\n");
15}
16
17void
18sigusr2 (void)
19{
20 printf ("processed usr2\n");
21}
22
23struct quagga_signal_t sigs[] =
24{
25 {
26 .signal = SIGHUP,
27 .handler = &sighup,
28 },
29 {
30 .signal = SIGUSR1,
31 .handler = &sigusr1,
32 },
33 {
34 .signal = SIGUSR2,
35 .handler = &sigusr2,
36 }
37};
38
39struct thread_master *master;
40struct thread t;
41
42int
43main (void)
44{
45 master = thread_master_create ();
46 signal_init (master, Q_SIGC(sigs), sigs);
Paul Jakmaf783c1d2006-05-28 08:31:17 +000047
48 zlog_default = openzlog("testsig", ZLOG_NONE,
49 LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
50 zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
51 zlog_set_level (NULL, ZLOG_DEST_STDOUT, LOG_DEBUG);
52 zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED);
53
paul9a76e2d2004-01-19 21:25:17 +000054 while (thread_fetch (master, &t))
55 thread_call (&t);
56
57 exit (0);
58}