Annotation of embedaddon/quagga/tests/test-sig.c, revision 1.1.1.2
1.1 misho 1: #include <zebra.h>
2: #include <sigevent.h>
3: #include "lib/log.h"
1.1.1.2 ! misho 4: #include "lib/memory.h"
1.1 misho 5:
6: void
7: sighup (void)
8: {
9: printf ("processed hup\n");
10: }
11:
12: void
13: sigusr1 (void)
14: {
15: printf ("processed usr1\n");
16: }
17:
18: void
19: sigusr2 (void)
20: {
21: printf ("processed usr2\n");
22: }
23:
24: struct 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:
40: struct thread_master *master;
41: struct thread t;
42:
43: int
44: main (void)
45: {
46: master = thread_master_create ();
1.1.1.2 ! misho 47: signal_init (master, array_size(sigs), sigs);
1.1 misho 48:
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:
55: while (thread_fetch (master, &t))
56: thread_call (&t);
57:
58: exit (0);
59: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>