2016-05-03 20:02:26 +00:00
|
|
|
// The library for various signal related issues.
|
2006-10-29 21:09:11 +00:00
|
|
|
#ifndef FISH_SIGNALH
|
|
|
|
#define FISH_SIGNALH
|
2005-10-06 07:30:50 +00:00
|
|
|
|
2012-08-15 07:57:56 +00:00
|
|
|
#include <signal.h>
|
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Get the integer signal value representing the specified signal, or -1 of no signal was found.
|
2012-11-19 00:30:30 +00:00
|
|
|
int wcs2sig(const wchar_t *str);
|
2005-10-06 07:30:50 +00:00
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Get string representation of a signal.
|
2012-11-19 00:30:30 +00:00
|
|
|
const wchar_t *sig2wcs(int sig);
|
2005-10-06 07:30:50 +00:00
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Returns a description of the specified signal.
|
2012-11-19 00:30:30 +00:00
|
|
|
const wchar_t *signal_get_desc(int sig);
|
2005-10-06 07:30:50 +00:00
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Set all signal handlers to SIG_DFL.
|
2005-10-06 11:54:16 +00:00
|
|
|
void signal_reset_handlers();
|
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Set signal handlers to fish default handlers.
|
2005-10-06 07:30:50 +00:00
|
|
|
void signal_set_handlers();
|
2005-10-06 11:54:16 +00:00
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Tell fish what to do on the specified signal.
|
|
|
|
///
|
|
|
|
/// \param sig The signal to specify the action of
|
|
|
|
/// \param do_handle If true fish will catch the specified signal and fire an event, otherwise the
|
|
|
|
/// default action (SIG_DFL) will be set
|
2012-11-19 00:30:30 +00:00
|
|
|
void signal_handle(int sig, int do_handle);
|
2005-10-14 11:40:33 +00:00
|
|
|
|
2017-05-03 03:55:41 +00:00
|
|
|
/// Ensure we did not inherit any blocked signals. See issue #3964.
|
|
|
|
void signal_unblock_all();
|
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Block all signals.
|
2017-02-27 05:46:15 +00:00
|
|
|
void signal_block(bool force = false);
|
2005-10-14 11:40:33 +00:00
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Unblock all signals.
|
2017-02-27 05:46:15 +00:00
|
|
|
void signal_unblock(bool force = false);
|
2006-10-29 21:09:11 +00:00
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Returns true if signals are being blocked.
|
2012-12-05 00:00:35 +00:00
|
|
|
bool signal_is_blocked();
|
2006-10-29 21:09:11 +00:00
|
|
|
|
2016-05-03 20:02:26 +00:00
|
|
|
/// Returns signals with non-default handlers.
|
2012-08-15 07:57:56 +00:00
|
|
|
void get_signals_with_handlers(sigset_t *set);
|
|
|
|
|
2016-12-29 02:52:33 +00:00
|
|
|
extern bool ignore_signal_block;
|
2006-10-29 21:09:11 +00:00
|
|
|
#endif
|