1 /* Utility functions for hooking process termination signals.
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.
8 * The hooks are not called upon normal process termination via exit(). Use
9 * atexit() to hook normal process termination.
11 * These functions will only work properly for single-threaded processes. */
13 #ifndef FATAL_SIGNAL_H
14 #define FATAL_SIGNAL_H 1
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);
21 /* Convenience functions for unlinking files upon termination.
23 * These functions also unlink the files upon normal process termination via
25 void fatal_signal_add_file_to_unlink(const char *);
26 void fatal_signal_remove_file_to_unlink(const char *);
28 #endif /* fatal-signal.h */