X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-signal.lisp;h=87f42d1bf544416bf1f29f328fc3a0dae6df448f;hb=860543cc7ba0266e41e1d41ac9b6a208f3795f1a;hp=5be6e2e9c0d02c94d111c02d7635ce47d56d60df;hpb=68a83a65688bb578163c502e045da298d20a1f0c;p=sbcl.git diff --git a/src/code/target-signal.lisp b/src/code/target-signal.lisp index 5be6e2e..87f42d1 100644 --- a/src/code/target-signal.lisp +++ b/src/code/target-signal.lisp @@ -18,62 +18,50 @@ ;;;; system calls that deal with signals #!-sb-fluid (declaim (inline real-unix-kill)) -(sb!alien:def-alien-routine ("kill" real-unix-kill) sb!c-call:int - (pid sb!c-call:int) - (signal sb!c-call:int)) +(sb!alien:define-alien-routine ("kill" real-unix-kill) sb!alien:int + (pid sb!alien:int) + (signal sb!alien:int)) +;;; Send the signal SIGNAL to the process with process id PID. SIGNAL +;;; should be a valid signal number or a keyword of the standard UNIX +;;; signal name. (defun unix-kill (pid signal) - #!+sb-doc - "Unix-kill sends the signal signal to the process with process - id pid. Signal should be a valid signal number or a keyword of the - standard UNIX signal name." (real-unix-kill pid (unix-signal-number signal))) #!-sb-fluid (declaim (inline real-unix-killpg)) -(sb!alien:def-alien-routine ("killpg" real-unix-killpg) sb!c-call:int - (pgrp sb!c-call:int) - (signal sb!c-call:int)) +(sb!alien:define-alien-routine ("killpg" real-unix-killpg) sb!alien:int + (pgrp sb!alien:int) + (signal sb!alien:int)) +;;; Send the signal SIGNAL to the all the process in process group +;;; PGRP. SIGNAL should be a valid signal number or a keyword of the +;;; standard UNIX signal name. (defun unix-killpg (pgrp signal) - #!+sb-doc - "Unix-killpg sends the signal signal to the all the process in process - group PGRP. Signal should be a valid signal number or a keyword of - the standard UNIX signal name." (real-unix-killpg pgrp (unix-signal-number signal))) -(sb!alien:def-alien-routine ("sigblock" unix-sigblock) sb!c-call:unsigned-long - #!+sb-doc - "Unix-sigblock cause the signals specified in mask to be - added to the set of signals currently being blocked from - delivery. The macro sigmask is provided to create masks." - (mask sb!c-call:unsigned-long)) - -(sb!alien:def-alien-routine ("sigpause" unix-sigpause) sb!c-call:void - #!+sb-doc - "Unix-sigpause sets the set of masked signals to its argument - and then waits for a signal to arrive, restoring the previous - mask upon its return." - (mask sb!c-call:unsigned-long)) - -(sb!alien:def-alien-routine ("sigsetmask" unix-sigsetmask) - sb!c-call:unsigned-long - #!+sb-doc - "Unix-sigsetmask sets the current set of masked signals (those - begin blocked from delivery) to the argument. The macro sigmask - can be used to create the mask. The previous value of the signal - mask is returned." - (mask sb!c-call:unsigned-long)) +;;; Set the current set of masked signals (those being blocked from +;;; delivery). +;;; +;;; (Note: CMU CL had a SIGMASK operator to create masks, but since +;;; SBCL only uses 0, we no longer support it. If you need it, you +;;; can pull it out of the CMU CL sources, or the old SBCL sources; +;;; but you might also consider doing things the SBCL way and moving +;;; this kind of C-level work down to C wrapper functions.) +#!-sunos +(sb!alien:define-alien-routine ("sigsetmask" unix-sigsetmask) + sb!alien:unsigned-long + (mask sb!alien:unsigned-long)) ;;;; 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 - (signal sb!c-call:int) - (handler sb!c-call:unsigned-long)) +(sb!alien:define-alien-routine ("install_handler" install-handler) + sb!alien:unsigned-long + (signal sb!alien:int) + (handler sb!alien:unsigned-long)) ;;;; interface to enabling and disabling signal handlers (defun enable-interrupt (signal-designator handler) - (declare (type (or function (member :default :ignore)) handler)) + (declare (type (or function fixnum (member :default :ignore)) handler)) (without-gcing (let ((result (install-handler (unix-signal-number signal-designator) (case handler @@ -84,7 +72,7 @@ handler)))))) (cond ((= result sig_dfl) :default) ((= result sig_ign) :ignore) - (t (the function (sb!kernel:make-lisp-obj result))))))) + (t (the (or function fixnum) (sb!kernel:make-lisp-obj result))))))) (defun default-interrupt (signal) (enable-interrupt signal :default)) @@ -98,7 +86,7 @@ ;;; 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 +;;; SIGINT in --disable-debugger 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)) @@ -126,11 +114,15 @@ #!-linux (define-signal-handler sigsys-handler "bad argument to a system call") (define-signal-handler sigpipe-handler "SIGPIPE") -(define-signal-handler sigalrm-handler "SIGALRM") + +(defun sigalrm-handler (signal info context) + (declare (ignore signal info context)) + (declare (type system-area-pointer context)) + (cerror "Continue" 'sb!ext::timeout)) (defun sigquit-handler (signal code context) (declare (ignore signal code context)) - (throw 'sb!impl::top-level-catcher nil)) + (throw 'sb!impl::toplevel-catcher nil)) (defun sb!kernel:signal-cold-init-or-reinit () #!+sb-doc @@ -155,8 +147,8 @@ ;;; CMU CL comment: ;;; Magically converted by the compiler into a break instruction. -(defun do-pending-interrupt () - (do-pending-interrupt)) +(defun receive-pending-interrupt () + (receive-pending-interrupt)) ;;; stale code which I'm insufficiently motivated to test -- WHN 19990714 #|