]> git.proxmox.com Git - mirror_frr.git/blame - lib/sigevent.h
lib: Hide list macros in linklist.c
[mirror_frr.git] / lib / sigevent.h
CommitLineData
d62a17ae 1/*
c49b3069 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 *
896014f4
DL
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c49b3069 21 */
22
7cc91e67
DS
23#ifndef _FRR_SIGNAL_H
24#define _FRR_SIGNAL_H
05c447dd 25
c49b3069 26#include <thread.h>
27
5e244469
RW
28#ifdef __cplusplus
29extern "C" {
30#endif
31
7cc91e67 32#define FRR_SIGNAL_TIMER_INTERVAL 2L
c49b3069 33
7cc91e67 34struct frr_signal_t {
d62a17ae 35 int signal; /* signal number */
36 void (*handler)(void); /* handler to call */
c49b3069 37
d62a17ae 38 volatile sig_atomic_t caught; /* private member */
c49b3069 39};
40
41/* initialise sigevent system
42 * takes:
43 * - pointer to valid struct thread_master
44 * - number of elements in passed in signals array
7cc91e67 45 * - array of frr_signal_t's describing signals to handle
c49b3069 46 * and handlers to use for each signal
47 */
d62a17ae 48extern void signal_init(struct thread_master *m, int sigc,
7cc91e67 49 struct frr_signal_t *signals);
c49b3069 50
976c5cc1
MS
51
52/*
53 * Check whether any signals have been received and are pending. This is done
54 * with the application's key signals blocked. The complete set of signals
55 * is returned in 'setp', so the caller can restore them when appropriate.
56 * If there are pending signals, returns 'true', 'false' otherwise.
57 */
58bool frr_sigevent_check(sigset_t *setp);
59
05c447dd 60/* check whether there are signals to handle, process any found */
7cc91e67 61extern int frr_sigevent_process(void);
05c447dd 62
5e244469
RW
63#ifdef __cplusplus
64}
65#endif
66
7cc91e67 67#endif /* _FRR_SIGNAL_H */