7d716da41d1416cacde6db3067eec1966a6d3aa5
[openvswitch] / include / fatal-signal.h
1 /* Utility functions for hooking process termination signals.
2  *
3  * Hooks registered with this module are called by handlers for signals that
4  * terminate the process normally (e.g. SIGTERM, SIGINT).  They are not called
5  * for signals that indicate program errors (e.g. SIGFPE, SIGSEGV).  They are
6  * useful for cleanup, such as deleting temporary files.
7  *
8  * The hooks are not called upon normal process termination via exit().  Use
9  * atexit() to hook normal process termination.
10  *
11  * These functions will only work properly for single-threaded processes. */
12
13 #ifndef FATAL_SIGNAL_H
14 #define FATAL_SIGNAL_H 1
15
16 /* Basic interface. */
17 void fatal_signal_add_hook(void (*)(void *aux), void *aux);
18 void fatal_signal_block(void);
19 void fatal_signal_unblock(void);
20
21 /* Convenience functions for unlinking files upon termination.
22  *
23  * These functions also unlink the files upon normal process termination via
24  * exit(). */
25 void fatal_signal_add_file_to_unlink(const char *);
26 void fatal_signal_remove_file_to_unlink(const char *);
27
28 #endif /* fatal-signal.h */