Ignore:
Timestamp:
Jul 11, 2011, 8:42:13 PM (8 years ago)
Author:
rme
Message:

Change signature of install_signal_handler() and update
callers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-exceptions.c

    r14871 r14873  
    18651865#ifndef WINDOWS
    18661866void
    1867 install_signal_handler(int signo, void * handler, Boolean system, Boolean on_altstack)
     1867install_signal_handler(int signo, void *handler, unsigned flags)
    18681868{
    18691869  struct sigaction sa;
     1870  int err;
    18701871 
    18711872  sa.sa_sigaction = (void *)handler;
     
    18751876  sigdelset(&sa.sa_mask,SIGTRAP);  /* let GDB work */
    18761877#endif
    1877   sa.sa_flags =
    1878     0 /* SA_RESTART */
    1879     | SA_SIGINFO
     1878  sa.sa_flags = SA_SIGINFO;
     1879
    18801880#ifdef USE_SIGALTSTACK
    1881     | (on_altstack ? SA_ONSTACK : 0)
    1882 #endif
    1883 ;
    1884 
    1885   sigaction(signo, &sa, NULL);
    1886   if (system) {
     1881  if (flags & ON_ALTSTACK)
     1882    sa.sa_flags |= SA_ONSTACK;
     1883#endif
     1884  if (flags & RESTART_SYSCALLS)
     1885    sa.sa_flags |= SA_RESTART;
     1886  if (flags & RESERVE_FOR_LISP) {
    18871887    extern sigset_t user_signals_reserved;
    18881888    sigaddset(&user_signals_reserved, signo);
     1889  }
     1890
     1891  err = sigaction(signo, &sa, NULL);
     1892  if (err) {
     1893    perror("sigaction");
     1894    exit(1);
    18891895  }
    18901896}
     
    20932099{
    20942100#ifndef DARWIN 
    2095   void *handler = (void *)
     2101  void *handler, *interrupt_hander;
     2102
    20962103#ifdef USE_SIGALTSTACK
    2097     altstack_signal_handler
    2098 #else
    2099     arbstack_signal_handler;
    2100 #endif
    2101   ;
    2102   install_signal_handler(SIGILL, handler, true, true);
     2104  handler = (void *)altstack_signal_handler;
     2105  interrupt_handler = (void *)altstack_interrupt_handler;
     2106#else
     2107  handler = (void *)arbstack_signal_handler;
     2108  interrupt_handler = (void *)arbstack_interrupt_handler;
     2109#endif
     2110
     2111  install_signal_handler(SIGILL, handler, RESERVE_FOR_LISP|ON_ALTSTACK);
     2112  install_signal_handler(SIGBUS, handler, RESERVE_FOR_LISP|ON_ALTSTACK);
     2113  install_signal_handler(SIGSEGV, handler, RESERVE_FOR_LISP|ON_ALTSTACK);
     2114  install_signal_handler(SIGFPE, handler, RESERVE_FOR_LISP|ON_ALTSTACK);
     2115#endif
    21032116 
    2104   install_signal_handler(SIGBUS, handler, true, true);
    2105   install_signal_handler(SIGSEGV,handler, true, true);
    2106   install_signal_handler(SIGFPE, handler, true, true);
    2107 #endif
    2108  
    2109   install_signal_handler(SIGNAL_FOR_PROCESS_INTERRUPT,
    2110 #ifdef USE_SIGALTSTACK
    2111                          altstack_interrupt_handler
    2112 #else
    2113                          arbstack_interrupt_handler
    2114 #endif
    2115                          , true, true);
     2117  install_signal_handler(SIGNAL_FOR_PROCESS_INTERRUPT, interrupt_handler,
     2118                         RESERVE_FOR_LISP|ON_ALTSTACK);
    21162119  signal(SIGPIPE, SIG_IGN);
    21172120}
     
    23072310  thread_kill_signal = SIG_KILL_THREAD;
    23082311
    2309   install_signal_handler(thread_suspend_signal, (void *)SUSPEND_RESUME_HANDLER, true, true);
    2310   install_signal_handler(thread_kill_signal, (void *)THREAD_KILL_HANDLER, true, true);
     2312  install_signal_handler(thread_suspend_signal, (void *)SUSPEND_RESUME_HANDLER,
     2313                         RESERVE_FOR_LISP|ON_ALTSTACK);
     2314  install_signal_handler(thread_kill_signal, (void *)THREAD_KILL_HANDLER,
     2315                         RESERVE_FOR_LISP|ON_ALTSTACK);
    23112316}
    23122317#endif
Note: See TracChangeset for help on using the changeset viewer.