0.pre7.14:
[sbcl.git] / src / code / target-signal.lisp
index e81c212..5be6e2e 100644 (file)
@@ -11,9 +11,6 @@
 
 (in-package "SB!UNIX")
 
-(file-comment
-  "$Header$")
-
 ;;; These should probably be somewhere, but I don't know where.
 (defconstant sig_dfl 0)
 (defconstant sig_ign 1)
 \f
 ;;;; C routines that actually do all the work of establishing signal handlers
 (sb!alien:def-alien-routine ("install_handler" install-handler)
-                         sb!c-call:unsigned-long
+                           sb!c-call:unsigned-long
   (signal sb!c-call:int)
   (handler sb!c-call:unsigned-long))
 \f
 ;;;; interface to enabling and disabling signal handlers
 
-(defun enable-interrupt (signal handler)
+(defun enable-interrupt (signal-designator handler)
   (declare (type (or function (member :default :ignore)) handler))
   (without-gcing
-   (let ((result (install-handler (unix-signal-number signal)
+   (let ((result (install-handler (unix-signal-number signal-designator)
                                  (case handler
                                    (:default sig_dfl)
                                    (:ignore sig_ign)
 ;;;;
 ;;;; Most of these just call ERROR to report the presence of the signal.
 
+;;; SIGINT is handled like BREAK, except that ANSI BREAK ignores
+;;; *DEBUGGER-HOOK*, but we want SIGINT's BREAK to respect it, so that
+;;; SIGINT in --noprogrammer mode will cleanly terminate the system
+;;; (by respecting the *DEBUGGER-HOOK* established in that mode).
+(defun sigint-%break (format-string &rest format-arguments)
+  (apply #'%break 'sigint format-string format-arguments))
+
 (eval-when (:compile-toplevel :execute)
   (sb!xc:defmacro define-signal-handler (name
                                         what
                  (with-alien ((context (* os-context-t) context))
                    (sap-int (sb!vm:context-pc context)))))))
 
-(define-signal-handler sigint-handler "interrupted" break)
+(define-signal-handler sigint-handler "interrupted" sigint-%break)
 (define-signal-handler sigill-handler "illegal instruction")
 (define-signal-handler sigtrap-handler "breakpoint/trap")
 (define-signal-handler sigiot-handler "SIGIOT")
   (enable-interrupt :sigsys #'sigsys-handler)
   (enable-interrupt :sigpipe #'sigpipe-handler)
   (enable-interrupt :sigalrm #'sigalrm-handler)
-  nil)
+  (values))
+\f
+;;;; etc.
+
+;;; CMU CL comment:
+;;;   Magically converted by the compiler into a break instruction.
+(defun do-pending-interrupt ()
+  (do-pending-interrupt))
 \f
 ;;; stale code which I'm insufficiently motivated to test -- WHN 19990714
 #|