]> git.proxmox.com Git - mirror_frr.git/blob - lib/sigevent.h
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / sigevent.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Quagga Signal handling header.
4 *
5 * Copyright (C) 2004 Paul Jakma.
6 */
7
8 #ifndef _FRR_SIGNAL_H
9 #define _FRR_SIGNAL_H
10
11 #include <frrevent.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #define FRR_SIGNAL_TIMER_INTERVAL 2L
18
19 struct frr_signal_t {
20 int signal; /* signal number */
21 void (*handler)(void); /* handler to call */
22
23 volatile sig_atomic_t caught; /* private member */
24 };
25
26 /* initialise sigevent system
27 * takes:
28 * - pointer to valid struct event_loop
29 * - number of elements in passed in signals array
30 * - array of frr_signal_t's describing signals to handle
31 * and handlers to use for each signal
32 */
33 extern void signal_init(struct event_loop *m, int sigc,
34 struct frr_signal_t *signals);
35
36
37 /*
38 * Check whether any signals have been received and are pending. This is done
39 * with the application's key signals blocked. The complete set of signals
40 * is returned in 'setp', so the caller can restore them when appropriate.
41 * If there are pending signals, returns 'true', 'false' otherwise.
42 */
43 bool frr_sigevent_check(sigset_t *setp);
44
45 /* check whether there are signals to handle, process any found */
46 extern int frr_sigevent_process(void);
47
48 #ifdef __cplusplus
49 }
50 #endif
51
52 #endif /* _FRR_SIGNAL_H */