paul | c49b306 | 2004-01-19 21:23:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Quagga Signal handling header. |
| 3 | * |
| 4 | * Copyright (C) 2004 Paul Jakma. |
| 5 | * |
| 6 | * This file is part of Quagga. |
| 7 | * |
| 8 | * Quagga is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the |
| 10 | * Free Software Foundation; either version 2, or (at your option) any |
| 11 | * later version. |
| 12 | * |
| 13 | * Quagga is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with Quagga; see the file COPYING. If not, write to the Free |
| 20 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 21 | * 02111-1307, USA. |
| 22 | */ |
| 23 | |
| 24 | #ifndef _QUAGGA_SIGNAL_H |
| 25 | #define _QUAGGA_SIGNAL_H |
paul | 05c447d | 2004-07-22 19:14:27 +0000 | [diff] [blame] | 26 | |
paul | c49b306 | 2004-01-19 21:23:37 +0000 | [diff] [blame] | 27 | #include <thread.h> |
| 28 | |
| 29 | #define QUAGGA_SIGNAL_TIMER_INTERVAL 2L |
| 30 | #define Q_SIGC(sig) (sizeof(sig)/sizeof(sig[0])) |
| 31 | |
| 32 | struct quagga_signal_t |
| 33 | { |
| 34 | int signal; /* signal number */ |
| 35 | void (*handler) (void); /* handler to call */ |
| 36 | |
| 37 | volatile sig_atomic_t caught; /* private member */ |
| 38 | }; |
| 39 | |
| 40 | /* initialise sigevent system |
| 41 | * takes: |
| 42 | * - pointer to valid struct thread_master |
| 43 | * - number of elements in passed in signals array |
| 44 | * - array of quagga_signal_t's describing signals to handle |
| 45 | * and handlers to use for each signal |
| 46 | */ |
paul | 8cc4198 | 2005-05-06 21:25:49 +0000 | [diff] [blame] | 47 | extern void signal_init (struct thread_master *m, int sigc, |
paul | c49b306 | 2004-01-19 21:23:37 +0000 | [diff] [blame] | 48 | struct quagga_signal_t *signals); |
| 49 | |
paul | 05c447d | 2004-07-22 19:14:27 +0000 | [diff] [blame] | 50 | /* check whether there are signals to handle, process any found */ |
paul | 8cc4198 | 2005-05-06 21:25:49 +0000 | [diff] [blame] | 51 | extern int quagga_sigevent_process (void); |
paul | 05c447d | 2004-07-22 19:14:27 +0000 | [diff] [blame] | 52 | |
paul | c49b306 | 2004-01-19 21:23:37 +0000 | [diff] [blame] | 53 | #endif /* _QUAGGA_SIGNAL_H */ |