Back to index

plt-scheme  4.2.1
Defines | Functions
sighand.c File Reference
#include <signal.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NEED_SIGACTION
#define USE_SIGACTON_SIGNAL_KIND   SIGSEGV

Functions

void fault_handler (int sn, siginfo_t *si, void *ctx)
static void initialize_signal_handler (GCTYPE *gc)
static void remove_signal_handler (GCTYPE *gc)

Define Documentation

#define NEED_SIGACTION
#define USE_SIGACTON_SIGNAL_KIND   SIGSEGV

Function Documentation

void fault_handler ( int  sn,
siginfo_t *  si,
void ctx 
)

Definition at line 126 of file sighand.c.

{
  if (!designate_modified(si->si_addr))
    abort();
#  define NEED_SIGACTION
#  define USE_SIGACTON_SIGNAL_KIND SIGSEGV
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void initialize_signal_handler ( GCTYPE gc) [static]

Definition at line 139 of file sighand.c.

{
# ifdef NEED_OSX_MACH_HANDLER
  macosx_init_exception_handler();
# endif
# ifdef NEED_SIGACTION
  {
    struct sigaction act, oact;
    memset(&act, 0, sizeof(sigaction));
    act.sa_sigaction = fault_handler;
    sigemptyset(&act.sa_mask);
    /* In MzScheme, SIGCHLD or SIGINT handling may trigger a write barrier: */
    sigaddset(&act.sa_mask, SIGINT);
    sigaddset(&act.sa_mask, SIGCHLD);
    act.sa_flags = SA_SIGINFO;
    sigaction(USE_SIGACTON_SIGNAL_KIND, &act, &oact);
  }
# endif
# ifdef NEED_SIGWIN
  {
    HMODULE hm;
    PVOID (WINAPI*aveh)(ULONG, gcPVECTORED_EXCEPTION_HANDLER);

    hm = LoadLibrary("kernel32.dll");
    if (hm)
      aveh = (PVOID (WINAPI*)(ULONG, gcPVECTORED_EXCEPTION_HANDLER))GetProcAddress(hm, "AddVectoredExceptionHandler");
    else
      aveh = NULL;
    
    if (aveh)
      aveh(TRUE, fault_handler);
    else  /* older than Windows XP */
      gc->generations_available = 0;
  }
# endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void remove_signal_handler ( GCTYPE gc) [static]

Definition at line 176 of file sighand.c.

{
# ifdef NEED_OSX_MACH_HANDLER
# endif
# ifdef NEED_SIGACTION
  {
    struct sigaction act, oact;
    memset(&act, 0, sizeof(sigaction));
    act.sa_handler = SIG_DFL;
    sigemptyset(&act.sa_mask);
    act.sa_flags = SA_SIGINFO;
    sigaction(USE_SIGACTON_SIGNAL_KIND, &act, &oact);
  }
# endif
# ifdef NEED_SIGWIN
  if (gc->generations_available) {
    HMODULE hm;

    hm = LoadLibrary("kernel32.dll");
    if (hm) {
      ULONG (WINAPI*rveh)(gcPVECTORED_EXCEPTION_HANDLER);
      rveh = (ULONG (WINAPI*)(gcPVECTORED_EXCEPTION_HANDLER))GetProcAddress(hm, "RemoveVectoredExceptionHandler");
      rveh(fault_handler);
    }
  }
# endif
}

Here is the call graph for this function:

Here is the caller graph for this function: