]> the.earth.li Git - onak.git/blob - cleanup.h
Bump debhelper compat level to 13
[onak.git] / cleanup.h
1 /*
2  * cleanup.h - Cleanup and shutdown framework.
3  *
4  * Copyright 2004 Jonathan McDowell <noodles@earth.li>
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program.  If not, see <https://www.gnu.org/licenses/>.
17  */
18
19 #ifndef __CLEANUP_H__
20 #define __CLEANUP_H__
21
22 #include <stdbool.h>
23
24 /*
25  *      trytocleanup - say we should try to cleanup.
26  *
27  *      This function sets the cleanup flag indicating we want to try and
28  *      cleanup ASAP.
29  */
30 void trytocleanup(void);
31
32 /*
33  *      cleanup - indicate if we should try to cleanup.
34  *
35  *      This function returns a bool which indicates if we want to cleanup and
36  *      exit ASAP.
37  */
38 bool cleanup(void);
39
40 /*
41  *      catchsignals - Register signal handlers for various signals.
42  *
43  *      This function registers a signal handler for various signals (PIPE,
44  *      ALRM, INT, TERM, HUP) that sets the cleanup flag so we try to exit
45  *      ASAP, but cleanly.
46  */
47 void catchsignals(void);
48
49 #endif /* __CLEANUP_H__ */