signal.c File Reference

The library for various signal related issues. More...

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
#include "common.h"
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "event.h"
#include "reader.h"
#include "proc.h"

Data Structures

struct  lookup_entry
 Struct describing an entry for the lookup table used to convert between signal names and signal ids, etc. More...

Functions

static int match_signal_name (const wchar_t *canonical, const wchar_t *name)
 Test if name is a string describing the signal named canonical.
int wcs2sig (const wchar_t *str)
 Get the integer signal value representing the specified signal, or -1 of no signal was found.
const wchar_t * sig2wcs (int sig)
 Get string representation of a signal.
const wchar_t * signal_get_desc (int sig)
 Returns a description of the specified signal.
static void default_handler (int signal, siginfo_t *info, void *context)
 Standard signal handler.
static void handle_winch (int sig, siginfo_t *info, void *context)
 Respond to a winch signal by checking the terminal size.
static void handle_hup (int sig, siginfo_t *info, void *context)
 Respond to a hup signal by exiting, unless it is caught by a shellscript function, in which case we do nothing.
static void handle_int (int sig, siginfo_t *info, void *context)
 Interactive mode ^C handler.
static void handle_chld (int sig, siginfo_t *info, void *context)
 sigchld handler.
void signal_reset_handlers ()
 Set all signal handlers to SIG_DFL.
void signal_set_handlers ()
 Sets appropriate signal handlers.
void signal_handle (int sig, int do_handle)
 Tell fish what to do on the specified signal.
void signal_block ()
 Block all signals.
void signal_unblock ()
 Unblock all signals.
int signal_is_blocked ()
 Returns true if signals are being blocked.

Variables

static int block_count = 0
 The number of signal blocks in place.
static const struct lookup_entry lookup []
 Lookup table used to convert between signal names and signal ids, etc.


Detailed Description

The library for various signal related issues.


Function Documentation

static void handle_chld ( int  sig,
siginfo_t *  info,
void *  context 
) [static]

sigchld handler.

Does notification and calls the handler in proc.c

References default_handler(), and job_handle_signal().

Referenced by signal_set_handlers().

static void handle_int ( int  sig,
siginfo_t *  info,
void *  context 
) [static]

Interactive mode ^C handler.

Respond to int signal by setting interrupted-flag and stopping all loops and conditionals.

References default_handler(), and reader_handle_int().

Referenced by signal_set_handlers().

void signal_handle ( int  sig,
int  do_handle 
)

Tell fish what to do on the specified signal.

Parameters:
sig The signal to specify the action of
do_handle If true fish will catch the specified signal and fire an event, otherwise the default action (SIG_DFL) will be set

References default_handler().

Referenced by event_add_handler(), and event_remove().

void signal_set_handlers (  ) 

Sets appropriate signal handlers.

Set signal handlers to fish default handlers.

References default_handler(), FATAL_EXIT, handle_chld(), handle_hup(), handle_int(), handle_winch(), is_interactive, and wperror().

Referenced by proc_pop_interactive(), proc_push_interactive(), and reader_interactive_init().


Variable Documentation

int block_count = 0 [static]

The number of signal blocks in place.

Increased by signal_block, decreased by signal_unblock.

Referenced by reader_interactive_init(), signal_block(), signal_is_blocked(), and signal_unblock().


Generated on Sun Mar 8 15:46:55 2009 for fish by  doxygen 1.5.6