Annotation of embedaddon/quagga/tests/test-sig.c, revision 1.1.1.3
1.1.1.3 ! misho 1: /*
! 2: * This file is part of Quagga.
! 3: *
! 4: * Quagga is free software; you can redistribute it and/or modify it
! 5: * under the terms of the GNU General Public License as published by the
! 6: * Free Software Foundation; either version 2, or (at your option) any
! 7: * later version.
! 8: *
! 9: * Quagga is distributed in the hope that it will be useful, but
! 10: * WITHOUT ANY WARRANTY; without even the implied warranty of
! 11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! 12: * General Public License for more details.
! 13: *
! 14: * You should have received a copy of the GNU General Public License
! 15: * along with Quagga; see the file COPYING. If not, write to the Free
! 16: * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
! 17: * 02111-1307, USA.
! 18: */
! 19:
1.1 misho 20: #include <zebra.h>
21: #include <sigevent.h>
22: #include "lib/log.h"
1.1.1.2 misho 23: #include "lib/memory.h"
1.1 misho 24:
1.1.1.3 ! misho 25: static void
1.1 misho 26: sighup (void)
27: {
28: printf ("processed hup\n");
29: }
30:
1.1.1.3 ! misho 31: static void
1.1 misho 32: sigusr1 (void)
33: {
34: printf ("processed usr1\n");
35: }
36:
1.1.1.3 ! misho 37: static void
1.1 misho 38: sigusr2 (void)
39: {
40: printf ("processed usr2\n");
41: }
42:
43: struct quagga_signal_t sigs[] =
44: {
45: {
46: .signal = SIGHUP,
47: .handler = &sighup,
48: },
49: {
50: .signal = SIGUSR1,
51: .handler = &sigusr1,
52: },
53: {
54: .signal = SIGUSR2,
55: .handler = &sigusr2,
56: }
57: };
58:
59: struct thread_master *master;
60: struct thread t;
61:
62: int
63: main (void)
64: {
65: master = thread_master_create ();
1.1.1.2 misho 66: signal_init (master, array_size(sigs), sigs);
1.1 misho 67:
68: zlog_default = openzlog("testsig", ZLOG_NONE,
69: LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
70: zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
71: zlog_set_level (NULL, ZLOG_DEST_STDOUT, LOG_DEBUG);
72: zlog_set_level (NULL, ZLOG_DEST_MONITOR, ZLOG_DISABLED);
73:
74: while (thread_fetch (master, &t))
75: thread_call (&t);
76:
77: exit (0);
78: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>