From 5a2b6553fbbbb62fa789350facd0d56bb136045f Mon Sep 17 00:00:00 2001
From: Alexey Dejneka <adejneka@comail.ru>
Date: Mon, 1 Sep 2003 07:55:42 +0000
Subject: [PATCH] 0.8.3.17:         * Take signal numbers from C land;        
 * use numeric constants instead of keywords to identify    
       signals (as per DB and WHN mails to sbcl-devel
 2003-08-31);         ... remove SB-UNIX:UNIX-SIGNAL-NUMBER
 and UNIX-SIGNAL-NAME.

---
 package-data-list.lisp-expr      |   63 ++++++++---------
 src/code/run-program.lisp        |   15 ++---
 src/code/signal.lisp             |  138 --------------------------------------
 src/code/target-signal.lisp      |   32 ++++-----
 src/code/target-thread.lisp      |   14 ++--
 src/code/target-unithread.lisp   |    2 +-
 src/code/thread.lisp             |    4 +-
 tools-for-build/Makefile         |    2 +
 tools-for-build/grovel_headers.c |   49 ++++++++++++++
 version.lisp-expr                |    2 +-
 10 files changed, 118 insertions(+), 203 deletions(-)

diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr
index 8eb7a7b..87ded6f 100644
--- a/package-data-list.lisp-expr
+++ b/package-data-list.lisp-expr
@@ -1796,7 +1796,7 @@ no guarantees of interface stability."
              "SETUIDEXEC" "SG-ERASE" "SG-FLAGS" "SG-ISPEED" "SG-KILL"
              "SG-OSPEED" "SGTTYB" "SIZE-T" "ST-ATIME" "ST-BLKSIZE"
              "ST-BLOCKS" "ST-CTIME" "ST-DEV" "ST-GID" "ST-MODE" "ST-MTIME"
-             "ST-NLINK" "ST-RDEV" "ST-SIZE" "ST-UID" "STAT" 
+             "ST-NLINK" "ST-RDEV" "ST-SIZE" "ST-UID" "STAT"
              "TERMINAL-SPEEDS" "TIME-T" "TIMEVAL" "TIMEZONE" "TIOCFLUSH"
              "TIOCGETC" "TIOCGETP" "TIOCGLTC" "TIOCGPGRP" "TIOCGWINSZ"
              "TIOCNOTTY" "TIOCSETC" "TIOCSETP" "TIOCSLTC" "TIOCSPGRP"
@@ -1821,35 +1821,38 @@ no guarantees of interface stability."
              "WRITEGRP" "WRITEOTH" "WRITEOWN" "WS-COL" "WS-ROW" "WS-XPIXEL"
              "WS-YPIXEL"
 	     "WNOHANG" "WSTOPPED" "WUNTRACED"
-	     "W_OK" "X_OK" "SIGSYS" "TCSETPGRP" "FD-ZERO"
-             "SIGQUIT" "SIGCHLD" "SIGSEGV" "FD-CLR" "SIGUSR2"
-             "EALREADY" "SIGPIPE" "CHECK" "SIGXCPU" "EOPNOTSUPP"
-             "SIGFPE" "SIGHUP" "ENOTSOCK" "EINTR"
-             "SIGCONT" "UNIX-RESOLVE-LINKS" "SIGKILL" "EMSGSIZE" "ERANGE"
-             "EPROTOTYPE" "UNIX-SIGNAL-NUMBER" "EPFNOSUPPORT" "SIGILL"
-             "EDOM" "EDQUOT" "FD-SETSIZE" "SIGTSTP"
-             "EAFNOSUPPORT" "TCGETPGRP" "EMFILE" "ECONNRESET"
-             "EADDRNOTAVAIL" "SIGALRM" "ENETDOWN" "EVICEOP"
-             "UNIX-FAST-GETRUSAGE" "EPERM" "SIGINT" "EXDEV" "EDEADLK"
-             "ENOSPC" "ECONNREFUSED" "SIGWINCH" "ENOPROTOOPT" "ESRCH"
-             "EUSERS" "SIGVTALRM" "ENOTCONN" "ESUCCESS" "EPIPE"
-             "UNIX-SIMPLIFY-PATHNAME" "EISCONN" "FD-ISSET"
-             "ESHUTDOWN" "EBUSY" "SIGTERM" "ENAMETOOLONG" "EMLINK"
-             "EADDRINUSE" "SIGBUS" "ERESTART" 
-             "UNIX-SIGNAL-NAME" "ETIMEDOUT" "ECHILD" "EFBIG" "SIGTRAP"
-             "UNIX-KILLPG" "ENOTBLK" "SIGIOT" "SIGUSR1" "ECONNABORTED"
-             "EHOSTUNREACH" "EBADF" "EINVAL" "FD-SET" "EISDIR"
-             "SIGTTIN" "UNIX-KILL" "EHOSTDOWN" "E2BIG" "ESPIPE"
-             "UNIX-FAST-SELECT" "ENXIO" "ENOTTY" "ELOOP" "LTCHARS"
-             "SIGXFSZ" "EINPROGRESS" "ENOENT"
-             "EPROTONOSUPPORT" "SIGIO" "ENOMEM" "SIGEMT"
-             "EFAULT" "ENODEV" "EIO" "EVICEERR" "ETXTBSY" "EWOULDBLOCK"
-             "EAGAIN" "EDESTADDRREQ" "ENOEXEC" "ENETUNREACH" "ENOTEMPTY"
-             "ENFILE"
-             "SIGTTOU" "EEXIST" "SIGPROF" "SIGSTOP" "ENETRESET" "SIGURG"
-             "ENOBUFS" "EPROCLIM" "EROFS" "ETOOMANYREFS" "UNIX-FILE-KIND"
-             "ELOCAL" "UNIX-SIGSETMASK" "EREMOTE" "ESOCKTNOSUPPORT"
-             "TIOCSIGSEND" "SIGWAITING"
+	     "W_OK" "X_OK"
+             ;; signals
+             "SIGALRM" "SIGBUS" "SIGCHLD" "SIGCONT" "SIGEMT" "SIGFPE"
+             "SIGHUP" "SIGILL" "SIGINT" "SIGIO" "SIGIOT" "SIGKILL"
+             "SIGPIPE" "SIGPROF" "SIGQUIT" "SIGSEGV" "SIGSTOP" "SIGSYS"
+             "SIGTERM" "SIGTRAP" "SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG"
+             "SIGUSR1" "SIGUSR2" "SIGVTALRM" "SIGWAITING" "SIGWINCH"
+             "SIGXCPU" "SIGXFSZ"
+
+             ;; errors
+             "E2BIG" "EADDRINUSE" "EADDRNOTAVAIL" "EAFNOSUPPORT"
+             "EAGAIN" "EALREADY" "EBADF" "EBUSY" "ECHILD" "ECONNABORTED"
+             "ECONNREFUSED" "ECONNRESET" "EDEADLK" "EDESTADDRREQ" "EDOM"
+             "EDQUOT" "EEXIST" "EFAULT" "EFBIG" "EHOSTDOWN"
+             "EHOSTUNREACH" "EINPROGRESS" "EINTR" "EINVAL" "EIO"
+             "EISCONN" "EISDIR" "ELOCAL" "ELOOP" "EMFILE" "EMLINK"
+             "EMSGSIZE" "ENAMETOOLONG" "ENETDOWN" "ENETRESET"
+             "ENETUNREACH" "ENFILE" "ENOBUFS" "ENODEV" "ENOENT"
+             "ENOEXEC" "ENOMEM" "ENOPROTOOPT" "ENOSPC" "ENOTBLK"
+             "ENOTCONN" "ENOTEMPTY" "ENOTSOCK" "ENOTTY" "ENXIO"
+             "EOPNOTSUPP" "EPERM" "EPFNOSUPPORT" "EPIPE" "EPROCLIM"
+             "EPROTONOSUPPORT" "EPROTOTYPE" "ERANGE" "EREMOTE"
+             "ERESTART" "EROFS" "ESHUTDOWN" "ESOCKTNOSUPPORT" "ESPIPE"
+             "ESRCH" "ESUCCESS" "ETIMEDOUT" "ETOOMANYREFS" "ETXTBSY"
+             "EUSERS" "EVICEERR" "EVICEOP" "EWOULDBLOCK" "EXDEV"
+
+             "FD-ISSET" "FD-SET" "LTCHARS" "UNIX-FAST-SELECT"
+             "UNIX-FILE-KIND" "UNIX-KILL" "UNIX-SIGSETMASK"
+             "TCSETPGRP" "FD-ZERO" "FD-CLR" "CHECK" "UNIX-RESOLVE-LINKS"
+             "FD-SETSIZE" "TCGETPGRP" "UNIX-FAST-GETRUSAGE"
+             "UNIX-SIMPLIFY-PATHNAME" "UNIX-KILLPG"
+             "TIOCSIGSEND"
              "C-IFLAG" "UNIX-TCGETATTR" "C-LFLAG" "C-OFLAG"
              "C-CFLAG" "TCSAFLUSH" "C-CC" "SIOCSPGRP" "TERMIOS"
              "UNIX-TCSETATTR" "O_NDELAY" "O_NOCTTY"
diff --git a/src/code/run-program.lisp b/src/code/run-program.lisp
index a04d1da..5ad4e12 100644
--- a/src/code/run-program.lisp
+++ b/src/code/run-program.lisp
@@ -124,10 +124,10 @@
 	     (values pid
 		     (if (position signal
 				   #.(vector
-				      (sb-unix:unix-signal-number :sigstop)
-				      (sb-unix:unix-signal-number :sigtstp)
-				      (sb-unix:unix-signal-number :sigttin)
-				      (sb-unix:unix-signal-number :sigttou)))
+				      sb-unix:sigstop
+				      sb-unix:sigtstp
+				      sb-unix:sigttin
+				      sb-unix:sigttou))
 			 :stopped
 			 :signaled)
 		     signal
@@ -212,7 +212,7 @@
 	   (sb-unix:unix-ioctl (sb-sys:fd-stream-fd (process-pty proc))
 			       sb-unix:TIOCSIGSEND
 			       (sb-sys:int-sap
-				(sb-unix:unix-signal-number signal))))
+				signal)))
 	  ((:process-group #-hpux :pty-process-group)
 	   (sb-unix:unix-killpg pid signal))
 	  (t
@@ -220,8 +220,7 @@
       (cond ((not okay)
 	     (values nil errno))
 	    ((and (eql pid (process-pid proc))
-		  (= (sb-unix:unix-signal-number signal)
-		     (sb-unix:unix-signal-number :sigcont)))
+		  (= signal sb-unix:sigcont))
 	     (setf (process-%status proc) :running)
 	     (setf (process-exit-code proc) nil)
 	     (when (process-status-hook proc)
@@ -537,7 +536,7 @@
   (when (and env-p environment-p)
     (error "can't specify :ENV and :ENVIRONMENT simultaneously"))
   ;; Make sure that the interrupt handler is installed.
-  (sb-sys:enable-interrupt :sigchld #'sigchld-handler)
+  (sb-sys:enable-interrupt sb-unix:sigchld #'sigchld-handler)
   ;; Prepend the program to the argument list.
   (push (namestring program) args)
   (let (;; Clear various specials used by GET-DESCRIPTOR-FOR to
diff --git a/src/code/signal.lisp b/src/code/signal.lisp
index 23cdd63..a4c5298 100644
--- a/src/code/signal.lisp
+++ b/src/code/signal.lisp
@@ -70,141 +70,3 @@
 	     (when *interrupt-pending*
 	       (receive-pending-interrupt))
 	     (,name))))))
-
-;;;; utilities for dealing with signal names and numbers
-
-(defstruct (unix-signal
-	    (:constructor make-unix-signal (%name %number))
-	    (:copier nil))
-  ;; signal keyword (e.g. :SIGINT for the Unix SIGINT signal)
-  (%name   (missing-arg) :type keyword :read-only t)
-  ;; signal number
-  (%number (missing-arg) :type integer :read-only t))
-
-;;; list of all defined UNIX-SIGNALs
-(defvar *unix-signals* nil)
-
-(defmacro !def-unix-signal (name number)
-  (declare (type keyword name))
-  (declare (type (and fixnum unsigned-byte) number))
-  `(push (make-unix-signal ,name ,number) *unix-signals*))
-
-(/show0 "signal.lisp 131")
-
-(defun unix-signal-or-lose (designator)
-  (or (find designator (the list *unix-signals*)
-	    :key (etypecase designator
-		   (symbol #'unix-signal-%name)
-		   (number #'unix-signal-%number)))
-      (error "not a valid signal name or number: ~S" designator)))
-
-(/show0 "signal.lisp 142")
-
-;;; Return the name of the designated signal.
-(defun unix-signal-name (designator)
-  (symbol-name (unix-signal-%name (unix-signal-or-lose designator))))
-
-(/show0 "signal.lisp 150")
-
-;;; Return the number of the designated signal.
-(defun unix-signal-number (designator)
-  (unix-signal-%number (unix-signal-or-lose designator)))
-
-(/show0 "signal.lisp 168")
-
-;;; known signals
-(/show0 "defining Unix signals")
-(!def-unix-signal :CHECK 0) ; check
-(/show0 "done defining CHECK")
-(!def-unix-signal :SIGHUP 1) ; hangup
-(/show0 "done defining SIGHUP")
-(!def-unix-signal :SIGINT 2) ; interrupt
-(/show0 "done defining SIGINT")
-(!def-unix-signal :SIGQUIT 3) ; quit
-(!def-unix-signal :SIGILL 4) ; illegal instruction
-(!def-unix-signal :SIGTRAP 5) ; trace trap
-(!def-unix-signal :SIGIOT 6) ; IOT instruction
-#!-linux
-(!def-unix-signal :SIGEMT 7) ; EMT instruction
-(!def-unix-signal :SIGFPE 8) ; floating point exception
-(!def-unix-signal :SIGKILL 9) ; kill
-(!def-unix-signal :SIGBUS #!-linux 10 #!+linux 7) ; bus error
-(!def-unix-signal :SIGSEGV 11) ; segmentation violation
-#!-linux
-(!def-unix-signal :SIGSYS 12) ; bad argument to system call
-(!def-unix-signal :SIGPIPE 13) ; write on a pipe with no one to read it
-(!def-unix-signal :SIGALRM 14) ; alarm clock
-(!def-unix-signal :SIGTERM 15) ; software termination signal
-#!+linux
-(!def-unix-signal :SIGSTKFLT 16) ; stack fault on coprocessor
-(!def-unix-signal :SIGURG ; urgent condition present on socket
-  #!+svr4 21
-  #!-(or hpux svr4 linux) 16
-  #!+hpux 29
-  #!+linux 23)
-(!def-unix-signal :SIGSTOP ; stop
-  #!-(or hpux svr4 linux) 17
-  #!+hpux 24
-  #!+svr4 23
-  #!+linux 19)
-(!def-unix-signal :SIGTSTP ;  stop signal generated from keyboard
-  #!-(or hpux svr4 linux) 18
-  #!+hpux 25
-  #!+svr4 24
-  #!+linux 20)
-(!def-unix-signal :SIGCONT ; continue after stop
-  #!-(or hpux svr4 linux) 19
-  #!+hpux 26
-  #!+svr4 25
-  #!+linux 18)
-(!def-unix-signal :SIGCHLD ; Child status has changed.
-  #!-(or linux hpux) 20
-  #!+hpux 18
-  #!+linux 17)
-(!def-unix-signal :SIGTTIN ; background read attempted from control terminal
-  #!-(or hpux svr4) 21
-  #!+hpux 27
-  #!+svr4 26)
-(!def-unix-signal :SIGTTOU ; background write attempted to control terminal
-  #!-(or hpux svr4) 22
-  #!+hpux 28
-  #!+svr4 27)
-(!def-unix-signal :SIGIO ; I/O is possible on a descriptor.
-  #!-(or hpux irix linux) 23
-  #!+(or hpux irix) 22
-  #!+linux 29)
-#!-hpux
-(!def-unix-signal :SIGXCPU ; CPU time limit exceeded
-  #!-svr4 24
-  #!+svr4 30)
-#!-hpux
-(!def-unix-signal :SIGXFSZ ;  file size limit exceeded
-  #!-svr4 25
-  #!+svr4 31)
-(!def-unix-signal :SIGVTALRM ; virtual time alarm
-  #!-(or hpux svr4) 26
-  #!+hpux 20
-  #!+svr4 28)
-(!def-unix-signal :SIGPROF ;  profiling timer alarm
-  #!-(or hpux svr4 linux) 27
-  #!+hpux 21
-  #!+svr4 29
-  #!+linux 30)
-(!def-unix-signal :SIGWINCH ; window size change
-  #!-(or hpux svr4) 28
-  #!+hpux 23
-  #!+svr4 20)
-(!def-unix-signal :SIGUSR1 ;  user-defined signal 1
-  #!-(or hpux svr4 linux) 30
-  #!+(or hpux svr4) 16
-  #!+linux 10)
-(!def-unix-signal :SIGUSR2 ; user-defined signal 2
-  #!-(or hpux svr4 linux) 31
-  #!+(or hpux svr4) 17
-  #!+linux 12)
-
-;;; SVR4 (or Solaris?) specific signals
-#!+svr4
-(!def-unix-signal :SIGWAITING 32) ; Process's LWPs are blocked.
-
-(/show0 "done with signal.lisp")
diff --git a/src/code/target-signal.lisp b/src/code/target-signal.lisp
index 87f42d1..58121c1 100644
--- a/src/code/target-signal.lisp
+++ b/src/code/target-signal.lisp
@@ -26,7 +26,7 @@
 ;;; should be a valid signal number or a keyword of the standard UNIX
 ;;; signal name.
 (defun unix-kill (pid signal)
-  (real-unix-kill pid (unix-signal-number signal)))
+  (real-unix-kill pid signal))
 
 #!-sb-fluid (declaim (inline real-unix-killpg))
 (sb!alien:define-alien-routine ("killpg" real-unix-killpg) sb!alien:int
@@ -37,7 +37,7 @@
 ;;; PGRP. SIGNAL should be a valid signal number or a keyword of the
 ;;; standard UNIX signal name.
 (defun unix-killpg (pgrp signal)
-  (real-unix-killpg pgrp (unix-signal-number signal)))
+  (real-unix-killpg pgrp signal))
 
 ;;; Set the current set of masked signals (those being blocked from
 ;;; delivery).
@@ -60,10 +60,10 @@
 
 ;;;; interface to enabling and disabling signal handlers
 
-(defun enable-interrupt (signal-designator handler)
+(defun enable-interrupt (signal handler)
   (declare (type (or function fixnum (member :default :ignore)) handler))
   (without-gcing
-   (let ((result (install-handler (unix-signal-number signal-designator)
+   (let ((result (install-handler signal
 				  (case handler
 				    (:default sig_dfl)
 				    (:ignore sig_ign)
@@ -127,20 +127,20 @@
 (defun sb!kernel:signal-cold-init-or-reinit ()
   #!+sb-doc
   "Enable all the default signals that Lisp knows how to deal with."
-  (enable-interrupt :sigint #'sigint-handler)
-  (enable-interrupt :sigquit #'sigquit-handler)
-  (enable-interrupt :sigill #'sigill-handler)
-  (enable-interrupt :sigtrap #'sigtrap-handler)
-  (enable-interrupt :sigiot #'sigiot-handler)
+  (enable-interrupt sigint #'sigint-handler)
+  (enable-interrupt sigquit #'sigquit-handler)
+  (enable-interrupt sigill #'sigill-handler)
+  (enable-interrupt sigtrap #'sigtrap-handler)
+  (enable-interrupt sigiot #'sigiot-handler)
   #!-linux
-  (enable-interrupt :sigemt #'sigemt-handler)
-  (enable-interrupt :sigfpe #'sb!vm:sigfpe-handler)
-  (enable-interrupt :sigbus #'sigbus-handler)
-  (enable-interrupt :sigsegv #'sigsegv-handler)
+  (enable-interrupt sigemt #'sigemt-handler)
+  (enable-interrupt sigfpe #'sb!vm:sigfpe-handler)
+  (enable-interrupt sigbus #'sigbus-handler)
+  (enable-interrupt sigsegv #'sigsegv-handler)
   #!-linux
-  (enable-interrupt :sigsys #'sigsys-handler)
-  (enable-interrupt :sigpipe #'sigpipe-handler)
-  (enable-interrupt :sigalrm #'sigalrm-handler)
+  (enable-interrupt sigsys #'sigsys-handler)
+  (enable-interrupt sigpipe #'sigpipe-handler)
+  (enable-interrupt sigalrm #'sigalrm-handler)
   (values))
 
 ;;;; etc.
diff --git a/src/code/target-thread.lisp b/src/code/target-thread.lisp
index d55ff8f..093f50f 100644
--- a/src/code/target-thread.lisp
+++ b/src/code/target-thread.lisp
@@ -17,7 +17,7 @@
 	  ;; can't use handling-end-of-the-world, because that flushes
 	  ;; output streams, and we don't necessarily have any (or we
 	  ;; could be sharing them)
-	  (sb!sys:enable-interrupt :sigint :ignore)
+	  (sb!sys:enable-interrupt sb!unix:sigint :ignore)
 	  (sb!unix:unix-exit
 	   (catch 'sb!impl::%end-of-the-world 
 	     (with-simple-restart 
@@ -30,16 +30,16 @@
 ;;; Conventional wisdom says that it's a bad idea to use these unless
 ;;; you really need to.  Use a lock or a waitqueue instead
 (defun suspend-thread (thread-id)
-  (sb!unix:unix-kill thread-id :sigstop))
+  (sb!unix:unix-kill thread-id sb!unix:sigstop))
 (defun resume-thread (thread-id)
-  (sb!unix:unix-kill thread-id :sigcont))
+  (sb!unix:unix-kill thread-id sb!unix:sigcont))
 ;;; Note warning about cleanup forms
 (defun destroy-thread (thread-id)
   "Destroy the thread identified by THREAD-ID abruptly, without running cleanup forms"
-  (sb!unix:unix-kill thread-id :sigterm)
+  (sb!unix:unix-kill thread-id sb!unix:sigterm)
   ;; may have been stopped for some reason, so now wake it up to
   ;; deliver the TERM
-  (sb!unix:unix-kill thread-id :sigcont))
+  (sb!unix:unix-kill thread-id sb!unix:sigcont))
 
 
 ;;; a moderate degree of care is expected for use of interrupt-thread,
@@ -128,7 +128,7 @@ SB-EXT:QUIT - the usual cleanup forms will be evaluated"
 ;;; this should only be called while holding the queue spinlock.
 (defun signal-queue-head (queue)
   (let ((p (car (waitqueue-data queue))))
-    (when p (sb!unix:unix-kill p  :sigcont))))
+    (when p (sb!unix:unix-kill p  sb!unix:sigcont))))
 
 ;;;; mutex
 
@@ -218,7 +218,7 @@ time we reacquire LOCK and return to the caller."
 		       (sb!sys:make-fd-stream err :input t :output t :buffering :line))
 		      (sb!impl::*descriptor-handlers* nil))
 		 (get-mutex *session-lock*)
-		 (sb!sys:enable-interrupt :sigint #'sb!unix::sigint-handler)
+		 (sb!sys:enable-interrupt sb!unix:sigint #'sb!unix::sigint-handler)
 		 (unwind-protect
 		      (sb!impl::toplevel-repl nil)
 		   (sb!int:flush-standard-output-streams)))))
diff --git a/src/code/target-unithread.lisp b/src/code/target-unithread.lisp
index e11ec9d..33f4b68 100644
--- a/src/code/target-unithread.lisp
+++ b/src/code/target-unithread.lisp
@@ -56,7 +56,7 @@
     (let ((h (car (waitqueue-data queue))))
       (setf (waitqueue-lock queue) 0)
       (when h
-	(sb!unix:unix-kill h :sigcont)))))
+	(sb!unix:unix-kill h sb!unix:sigcont)))))
 
 ;;;; mutex
 
diff --git a/src/code/thread.lisp b/src/code/thread.lisp
index 5129105..50be15f 100644
--- a/src/code/thread.lisp
+++ b/src/code/thread.lisp
@@ -32,14 +32,14 @@
 (defun get-foreground ()
   (when (not (eql (mutex-value *session-lock*) (current-thread-id)))
     (get-mutex *session-lock*))
-  (sb!sys:enable-interrupt :sigint #'sb!unix::sigint-handler)
+  (sb!sys:enable-interrupt sb!unix:sigint #'sb!unix::sigint-handler)
   t)
 #!-sb-thread
 (defun get-foreground () t)
 
 #!+sb-thread
 (defun release-foreground ()
-  (sb!sys:enable-interrupt :sigint :ignore)
+  (sb!sys:enable-interrupt sb!unix:sigint :ignore)
   (release-mutex *session-lock*)
   t)
 #!-sb-thread
diff --git a/tools-for-build/Makefile b/tools-for-build/Makefile
index 7bfcf6b..e6756b6 100644
--- a/tools-for-build/Makefile
+++ b/tools-for-build/Makefile
@@ -9,6 +9,8 @@
 
 include ../src/runtime/Config
 
+CPPFLAGS=-I../src/runtime
+
 all: grovel_headers determine-endianness
 
 clean: 
diff --git a/tools-for-build/grovel_headers.c b/tools-for-build/grovel_headers.c
index 0184bfa..a2e0f08 100644
--- a/tools-for-build/grovel_headers.c
+++ b/tools-for-build/grovel_headers.c
@@ -27,6 +27,9 @@
 #include <sys/termios.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <signal.h>
+
+#include "genesis/config.h"
 
 #define DEFTYPE(lispname,cname) { cname foo; \
     printf("(define-alien-type " lispname " (%s %d))\n", (((foo=-1)<0) ? "sb!alien:signed" : "unsigned"), (8 * (sizeof foo))); }
@@ -38,6 +41,8 @@ defconstant(char* lisp_name, long unix_number)
 	   lisp_name, unix_number, unix_number);
 }
 
+#define DEFSIGNAL(name) defconstant(#name, name)
+
 int
 main(int argc, char *argv[])
 {
@@ -139,5 +144,49 @@ main(int argc, char *argv[])
     */
     printf("\n");
 
+    printf(";;; signals\n");
+    DEFSIGNAL(SIGALRM);
+    DEFSIGNAL(SIGBUS);
+    DEFSIGNAL(SIGCHLD);
+    DEFSIGNAL(SIGCONT);
+#ifndef LISP_FEATURE_LINUX
+    DEFSIGNAL(SIGEMT);
+#endif
+    DEFSIGNAL(SIGFPE);
+    DEFSIGNAL(SIGHUP);
+    DEFSIGNAL(SIGILL);
+    DEFSIGNAL(SIGINT);
+    DEFSIGNAL(SIGIO);
+    DEFSIGNAL(SIGIOT);
+    DEFSIGNAL(SIGKILL);
+    DEFSIGNAL(SIGPIPE);
+    DEFSIGNAL(SIGPROF);
+    DEFSIGNAL(SIGQUIT);
+    DEFSIGNAL(SIGSEGV);
+#ifdef LISP_FEATURE_LINUX
+    DEFSIGNAL(SIGSTKFLT);
+#endif
+    DEFSIGNAL(SIGSTOP);
+#ifndef LISP_FEATURE_LINUX
+    DEFSIGNAL(SIGSYS);
+#endif
+    DEFSIGNAL(SIGTERM);
+    DEFSIGNAL(SIGTRAP);
+    DEFSIGNAL(SIGTSTP);
+    DEFSIGNAL(SIGTTIN);
+    DEFSIGNAL(SIGTTOU);
+    DEFSIGNAL(SIGURG);
+    DEFSIGNAL(SIGUSR1);
+    DEFSIGNAL(SIGUSR2);
+    DEFSIGNAL(SIGVTALRM);
+#ifdef LISP_FEATURE_SVR4
+    DEFSIGNAL(SIGWAITING);
+#endif
+    DEFSIGNAL(SIGWINCH);
+#ifndef LISP_FEATURE_HPUX
+    DEFSIGNAL(SIGXCPU);
+    DEFSIGNAL(SIGXFSZ);
+#endif
+
     return 0;
 }
diff --git a/version.lisp-expr b/version.lisp-expr
index 78e5def..afe5a66 100644
--- a/version.lisp-expr
+++ b/version.lisp-expr
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.3.16"
+"0.8.3.17"
-- 
1.7.10.4