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 20#include <zebra.h> 21#include <sigevent.h> 22#include "lib/log.h" 23#include "lib/memory.h" 24 25void 26sighup (void) 27{ 28 printf ("processed hup\n"); 29} 30 31void 32sigusr1 (void) 33{ 34 printf ("processed usr1\n"); 35} 36 37void 38sigusr2 (void) 39{ 40 printf ("processed usr2\n"); 41} 42 43struct 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 59struct thread_master *master; 60struct thread t; 61 62int 63main (void) 64{ 65 master = thread_master_create (); 66 signal_init (master, array_size(sigs), sigs); 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} 79