2 * Copyright (c) 2003, Derek Price and Ximbiot <http://ximbiot.com>
4 * You may distribute under the terms of the GNU General Public License
5 * as specified in the README file that comes with the CVS source
8 * This is a convenience wrapper for some of the functions in lib/sighandle.c.
14 * Register a handler for all signals.
17 signals_register (RETSIGTYPE (*handler
)(int))
19 #ifndef DONT_USE_SIGNALS
21 (void) SIG_register (SIGABRT
, handler
);
24 (void) SIG_register (SIGHUP
, handler
);
27 (void) SIG_register (SIGINT
, handler
);
30 (void) SIG_register (SIGQUIT
, handler
);
33 (void) SIG_register (SIGPIPE
, handler
);
36 (void) SIG_register (SIGTERM
, handler
);
38 #endif /* !DONT_USE_SIGNALS */
44 * Register a handler for all signals and exit.
47 cleanup_register (void (*handler
) (void))
51 /* Always calling this function before any other exit handlers guarantees
52 * that signals will be blocked by the time the other exit handlers are
55 * SIG_beginCrSect will be called once for each handler registered via
56 * cleanup_register, but there is no unregister routine for atexit() and
57 * this seems like minimal overhead.
59 * There is no reason to unblock signals again when the exit handlers are
60 * done since the program will be exiting anyhow.
62 atexit (SIG_beginCrSect
);