paul | 9a76e2d | 2004-01-19 21:25:17 +0000 | [diff] [blame] | 1 | #include <zebra.h> |
| 2 | #include <sigevent.h> |
Paul Jakma | 1602a71 | 2006-05-28 08:32:44 +0000 | [diff] [blame] | 3 | #include "lib/log.h" |
David Lamparter | 326fe3d | 2012-11-03 09:13:23 -0700 | [diff] [blame] | 4 | #include "lib/memory.h" |
paul | 9a76e2d | 2004-01-19 21:25:17 +0000 | [diff] [blame] | 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 (); |
Balaji.G | 837d16c | 2012-09-26 14:09:10 +0530 | [diff] [blame] | 47 | signal_init (master, array_size(sigs), sigs); |
Paul Jakma | f783c1d | 2006-05-28 08:31:17 +0000 | [diff] [blame] | 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 | |
paul | 9a76e2d | 2004-01-19 21:25:17 +0000 | [diff] [blame] | 55 | while (thread_fetch (master, &t)) |
| 56 | thread_call (&t); |
| 57 | |
| 58 | exit (0); |
| 59 | } |