Classes | Defines | Functions | Variables

sighandlers.cc File Reference

#include <cstdlib>
#include <iostream>
#include <new>
#include <sys/types.h>
#include <unistd.h>
#include "cmd-edit.h"
#include "oct-syscalls.h"
#include "quit.h"
#include "singleton-cleanup.h"
#include "debug.h"
#include "defun.h"
#include "error.h"
#include "input.h"
#include "load-save.h"
#include "oct-map.h"
#include "pager.h"
#include "pt-bp.h"
#include "pt-eval.h"
#include "sighandlers.h"
#include "sysdep.h"
#include "syswait.h"
#include "toplev.h"
#include "utils.h"
#include "variables.h"
Include dependency graph for sighandlers.cc:

Go to the source code of this file.

Classes

class  pid_equal

Defines

#define BADSIG   (void (*)(int))-1
#define BLOCK_CHILD(nvar, ovar)   BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
#define BLOCK_SIGNAL(sig, nvar, ovar)
#define OCL_REP   octave_child_list::octave_child_list_rep
#define UNBLOCK_CHILD(ovar)   GNULIB_NAMESPACE::sigprocmask (SIG_SETMASK, &ovar, 0)

Functions

 DEFUN (SIG, args,,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} SIG ()\n\ Return a structure containing Unix signal names and their defined values.\n\ @end deftypefn")
 DEFUN (sigterm_dumps_octave_core, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} sigterm_dumps_octave_core ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} sigterm_dumps_octave_core (@var{new_val})\n\ @deftypefnx {Built-in Function} {} sigterm_dumps_octave_core (@var{new_val}, \"local\")\n\ Query or set the internal variable that controls whether Octave tries\n\ to save all current variables to the file \"octave-core\" if it receives\n\ a terminate signal.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @end deftypefn")
 DEFUN (debug_on_interrupt, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} debug_on_interrupt ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} debug_on_interrupt (@var{new_val})\n\ @deftypefnx {Built-in Function} {} debug_on_interrupt (@var{new_val}, \"local\")\n\ Query or set the internal variable that controls whether Octave will try\n\ to enter debugging mode when it receives an interrupt signal (typically\n\ generated with @kbd{C-c}). If a second interrupt signal is received\n\ before reaching the debugging mode, a normal interrupt will occur.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @seealso{debug_on_error, debug_on_warning}\n\ @end deftypefn")
 DEFUN (sighup_dumps_octave_core, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} sighup_dumps_octave_core ()\n\ @deftypefnx {Built-in Function} {@var{old_val} =} sighup_dumps_octave_core (@var{new_val})\n\ @deftypefnx {Built-in Function} {} sighup_dumps_octave_core (@var{new_val}, \"local\")\n\ Query or set the internal variable that controls whether Octave tries\n\ to save all current variables to the file \"octave-core\" if it receives\n\ a hangup signal.\n\ \n\ When called from inside a function with the \"local\" option, the variable is\n\ changed locally for the function and any subroutines it calls. The original\n\ variable value is restored when exiting the function.\n\ @end deftypefn")
static void generic_sig_handler (int sig)
void install_signal_handlers (void)
static octave_scalar_map make_sig_struct (void)
static void my_friendly_exit (const char *sig_name, int sig_number, bool save_vars=true)
octave_interrupt_handler octave_catch_interrupts (void)
octave_interrupt_handler octave_ignore_interrupts (void)
octave_interrupt_handler octave_set_interrupt_handler (const volatile octave_interrupt_handler &h, bool restart_syscalls)
sig_handleroctave_set_signal_handler (int sig, sig_handler *handler, bool restart_syscalls)
void octave_signal_handler (void)
static void sigint_handler (int sig)
static void user_abort (const char *sig_name, int sig_number)

Variables

bool can_interrupt = false
static bool octave_signals_caught [NSIG]
int pipe_handler_error_count = 0
static bool Vdebug_on_interrupt = false
static bool Vsighup_dumps_octave_core = true
static bool Vsigterm_dumps_octave_core = true

Define Documentation

#define BADSIG   (void (*)(int))-1

Definition at line 79 of file sighandlers.cc.

#define BLOCK_CHILD (   nvar,
  ovar 
)    BLOCK_SIGNAL (SIGCHLD, nvar, ovar)

Definition at line 108 of file sighandlers.cc.

Referenced by octave_signal_handler().

#define BLOCK_SIGNAL (   sig,
  nvar,
  ovar 
)
Value:
do \
    { \
      GNULIB_NAMESPACE::sigemptyset (&nvar); \
      GNULIB_NAMESPACE::sigaddset (&nvar, sig); \
      GNULIB_NAMESPACE::sigemptyset (&ovar); \
      GNULIB_NAMESPACE::sigprocmask (SIG_BLOCK, &nvar, &ovar); \
    } \
  while (0)

Definition at line 94 of file sighandlers.cc.

Definition at line 870 of file sighandlers.cc.

#define UNBLOCK_CHILD (   ovar  )     GNULIB_NAMESPACE::sigprocmask (SIG_SETMASK, &ovar, 0)

Definition at line 109 of file sighandlers.cc.

Referenced by octave_signal_handler().


Function Documentation

DEFUN ( SIG  ,
args   
)

Definition at line 939 of file sighandlers.cc.

References make_sig_struct(), and print_usage().

DEFUN ( sigterm_dumps_octave_core  ,
args  ,
nargout   
)

Definition at line 1023 of file sighandlers.cc.

References SET_INTERNAL_VARIABLE.

DEFUN ( debug_on_interrupt  ,
args  ,
nargout   
)

Definition at line 965 of file sighandlers.cc.

References SET_INTERNAL_VARIABLE.

DEFUN ( sighup_dumps_octave_core  ,
args  ,
nargout   
)

Definition at line 995 of file sighandlers.cc.

References SET_INTERNAL_VARIABLE.

static void generic_sig_handler ( int  sig  )  [static]

Definition at line 240 of file sighandlers.cc.

References my_friendly_exit(), and strsignal().

Referenced by install_signal_handlers().

void install_signal_handlers ( void   ) 
static octave_scalar_map make_sig_struct ( void   )  [static]

Definition at line 658 of file sighandlers.cc.

References octave_scalar_map::assign().

Referenced by DEFUN().

static void my_friendly_exit ( const char sig_name,
int  sig_number,
bool  save_vars = true 
) [static]
octave_interrupt_handler octave_catch_interrupts ( void   ) 
octave_interrupt_handler octave_ignore_interrupts ( void   ) 

Definition at line 493 of file sighandlers.cc.

References octave_set_signal_handler().

Referenced by do_edit_history(), octave_kbhit(), and octave_signal_handler().

octave_interrupt_handler octave_set_interrupt_handler ( const volatile octave_interrupt_handler h,
bool  restart_syscalls 
)

Definition at line 509 of file sighandlers.cc.

References octave_set_signal_handler().

Referenced by do_edit_history(), octave_kbhit(), and octave_signal_handler().

sig_handler* octave_set_signal_handler ( int  sig,
sig_handler handler,
bool  restart_syscalls 
)
void octave_signal_handler ( void   ) 
static void sigint_handler ( int  sig  )  [static]

Definition at line 379 of file sighandlers.cc.

References strsignal(), and user_abort().

Referenced by octave_catch_interrupts().

static void user_abort ( const char sig_name,
int  sig_number 
) [static]

Variable Documentation

bool octave_signals_caught[NSIG] [static]

Definition at line 75 of file sighandlers.cc.

Referenced by install_signal_handlers(), and octave_signal_handler().

Definition at line 58 of file sighandlers.cc.

Referenced by octave_gets().

bool Vdebug_on_interrupt = false [static]

Definition at line 64 of file sighandlers.cc.

Referenced by user_abort().

Definition at line 69 of file sighandlers.cc.

Definition at line 72 of file sighandlers.cc.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines