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" |
paul | 9a76e2d | 2004-01-19 21:25:17 +0000 | [diff] [blame] | 4 | |
| 5 | void |
| 6 | sighup (void) |
| 7 | { |
| 8 | printf ("processed hup\n"); |
| 9 | } |
| 10 | |
| 11 | void |
| 12 | sigusr1 (void) |
| 13 | { |
| 14 | printf ("processed usr1\n"); |
| 15 | } |
| 16 | |
| 17 | void |
| 18 | sigusr2 (void) |
| 19 | { |
| 20 | printf ("processed usr2\n"); |
| 21 | } |
| 22 | |
| 23 | struct 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 | |
| 39 | struct thread_master *master; |
| 40 | struct thread t; |
| 41 | |
| 42 | int |
| 43 | main (void) |
| 44 | { |
| 45 | master = thread_master_create (); |
| 46 | signal_init (master, Q_SIGC(sigs), sigs); |
Paul Jakma | f783c1d | 2006-05-28 08:31:17 +0000 | [diff] [blame] | 47 | |
| 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 | |
paul | 9a76e2d | 2004-01-19 21:25:17 +0000 | [diff] [blame] | 54 | while (thread_fetch (master, &t)) |
| 55 | thread_call (&t); |
| 56 | |
| 57 | exit (0); |
| 58 | } |