Changeset 12196


Ignore:
Timestamp:
Jun 5, 2009, 1:03:18 AM (10 years ago)
Author:
gz
Message:

Merge r11497:r11498 into trunk: pass signal number through to async quit handler so can exit by resignalling.

Location:
trunk/source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/PPC/PPC32/ppc32-arch.lisp

    r11676 r12196  
    628628  lisp-pipe
    629629  lisp-gettimeofday
     630  lisp-sigexit
    630631)
    631632
  • trunk/source/compiler/PPC/PPC64/ppc64-arch.lisp

    r11676 r12196  
    698698  lisp-pipe
    699699  lisp-gettimeofday
     700  lisp-sigexit
    700701)
    701702
  • trunk/source/compiler/X86/X8632/x8632-arch.lisp

    r11749 r12196  
    745745  lisp-pipe
    746746  lisp-gettimeofday
     747  lisp-sigexit
    747748)
    748749
  • trunk/source/compiler/X86/X8664/x8664-arch.lisp

    r11676 r12196  
    845845  lisp-pipe
    846846  lisp-gettimeofday
     847  lisp-sigexit
    847848)
    848849
  • trunk/source/level-1/l1-events.lisp

    r12090 r12196  
    123123(defglobal *quit-interrupt-hook* nil)
    124124
    125 (defun force-async-quit ()
     125(defun force-async-quit (signum)
    126126  (when *quit-interrupt-hook*
    127     (funcall *quit-interrupt-hook*))
    128   (quit 143))
     127    (funcall *quit-interrupt-hook* signum))
     128  ;; Exit by resignalling, as per http://www.cons.org/cracauer/sigint.html
     129  (quit #'(lambda ()
     130            (ff-call (%kernel-import target::kernel-import-lisp-sigexit) :signed signum)
     131            ;; Shouldn't get here
     132            (#__exit 143))))
    129133
    130134(defstatic *running-periodic-tasks* nil)
     
    163167    (handle-gc-hooks)
    164168    (unless *inhibit-abort*
    165       (let ((id (pending-user-interrupt)))
    166         (cond ((eql id $user-interrupt-quit)
    167                ;; Doesn't matter where it happens, but try to use a process that
    168                ;; has a shot at reporting any problems in user hook.
     169      (let* ((id (pending-user-interrupt))
     170             (kind (logand #xFF id)))
     171        (cond ((eql kind $user-interrupt-quit)
     172               ;; Try to use a process that has a shot at reporting any problems
     173               ;; in case of bugs in user hook.
    169174               (let* ((proc (or (select-interactive-abort-process)
    170                                 *initial-process*)))
    171                  (process-interrupt proc #'force-async-quit)))
    172               ((eql id $user-interrupt-break)
     175                                *initial-process*))
     176                      (signum (ash id -8)))
     177                 (process-interrupt proc #'force-async-quit signum)))
     178              ((eql kind $user-interrupt-break)
    173179               (let* ((proc (select-interactive-abort-process)))
    174180                 (if proc
  • trunk/source/lisp-kernel/imports.s

    r11743 r12196  
    9999        defimport(lisp_pipe)
    100100        defimport(lisp_gettimeofday)
    101        
     101        defimport(lisp_sigexit)
    102102   
    103103        .globl C(import_ptrs_base)
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r12137 r12196  
    756756{
    757757  if (signum == SIGINT) {
    758     lisp_global(INTFLAG) = (1 << fixnumshift);
     758    lisp_global(INTFLAG) = (((signum<<8) + 1) << fixnumshift);
    759759  }
    760760  else if (signum == SIGTERM) {
    761     lisp_global(INTFLAG) = (2 << fixnumshift);
     761    lisp_global(INTFLAG) = (((signum<<8) + 2) << fixnumshift);
     762  }
     763  else if (signum == SIGQUIT) {
     764    lisp_global(INTFLAG) = (((signum<<8) + 2) << fixnumshift);
    762765  }
    763766#ifdef DARWIN
  • trunk/source/lisp-kernel/unix-calls.c

    r11061 r12196  
    3434#include <sys/time.h>
    3535#include <stdint.h>
     36#include <signal.h>
    3637
    3738ssize_t
     
    134135  return gettimeofday(tp, tzp);
    135136}
     137
     138int
     139lisp_sigexit(int signum)
     140{
     141  signal(signum, SIG_DFL);
     142  return kill(getpid(), signum);
     143}
  • trunk/source/lisp-kernel/windows-calls.c

    r12095 r12196  
    2525#include <psapi.h>
    2626#include <dirent.h>
     27#include <signal.h>
    2728#undef __argv
    2829#include <stdio.h>
     
    610611  tp->tv_usec = now%1000LL;
    611612  return 0;
     613}
     614
     615int
     616lisp_sigexit(int signum)
     617{
     618  signal(signum, SIG_DFL);
     619  return raise(signum);
    612620}
    613621
     
    907915  WSAStartup((2<<8)|2,&data);
    908916}
     917
Note: See TracChangeset for help on using the changeset viewer.