fish-shell/src/signal.h
Kurtis Rader e0f62c178f make not blocking signals the default
This is the next step in determining whether we can disable blocking
signals without a good reason to do so. This makes not blocking signals
the default behavior. If someone finds a problem they can add this to
their ~/config/fish/config.fish file:

set FISH_NO_SIGNAL_BLOCK 0

Alternatively set that env var before starting fish. I won't be surprised
if people report problems. Till now we have relied on people opting in
to this behavior to tell us whether it causes problems. This makes the
experimental behavior the default that has to be opted out of. This will
give us a lot more confidence this change doesn't cause problems before
the next minor release.

Note that there are still a few places where we force blocking of
signals. Primarily to keep SIGTSTP from interfering with the shell in
response to manipulating the controlling tty. Bash is more selective
in the signals it blocks around the problematic syscalls (c.f., its
`git_terminal_to()` function). However, I don't see any value in that
refinement.
2017-03-10 21:34:24 -08:00

42 lines
1.2 KiB
C

// The library for various signal related issues.
#ifndef FISH_SIGNALH
#define FISH_SIGNALH
#include <signal.h>
/// Get the integer signal value representing the specified signal, or -1 of no signal was found.
int wcs2sig(const wchar_t *str);
/// Get string representation of a signal.
const wchar_t *sig2wcs(int sig);
/// Returns a description of the specified signal.
const wchar_t *signal_get_desc(int sig);
/// Set all signal handlers to SIG_DFL.
void signal_reset_handlers();
/// Set signal handlers to fish default handlers.
void signal_set_handlers();
/// 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
void signal_handle(int sig, int do_handle);
/// Block all signals.
void signal_block(bool force = false);
/// Unblock all signals.
void signal_unblock(bool force = false);
/// Returns true if signals are being blocked.
bool signal_is_blocked();
/// Returns signals with non-default handlers.
void get_signals_with_handlers(sigset_t *set);
extern bool ignore_signal_block;
#endif