0.pre8.109
authorDaniel Barlow <dan@telent.net>
Sat, 26 Apr 2003 22:32:27 +0000 (22:32 +0000)
committerDaniel Barlow <dan@telent.net>
Sat, 26 Apr 2003 22:32:27 +0000 (22:32 +0000)
#+sb-threads check for Linux 2.4, because it won't work in 2.2
In the process, rename early_kernel to linux_sparc_siginfo_bug,
just to make its purpose a little more obvious

Export WITH-TIMEOUT and TIMEOUT from SB-EXT.  TIMEOUT is now a
SERIOUS-CONDITION not an ERROR

package-data-list.lisp-expr
src/code/condition.lisp
src/code/target-signal.lisp
src/code/unix.lisp
src/runtime/linux-os.c
src/runtime/sparc-arch.c
version.lisp-expr

index 7ec97a8..be590dc 100644 (file)
@@ -517,7 +517,7 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
     :export (;; Information about how the program was invoked is
              ;; nonstandard but very useful.
              "*POSIX-ARGV*" "POSIX-GETENV" "POSIX-ENVIRON"
-
+                           
              ;; People have various good reasons to mess with the GC.
              "*AFTER-GC-HOOKS*" "*BEFORE-GC-HOOKS*"
              "*GC-NOTIFY-AFTER*" "*GC-NOTIFY-BEFORE*" "*GC-NOTIFY-STREAM*"
@@ -617,6 +617,7 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
              ;; miscellaneous useful supported extensions
              "QUIT"
             "*MODULE-PROVIDER-FUNCTIONS*"
+            "WITH-TIMEOUT" "TIMEOUT"
             
              ;; RUN-PROGRAM is not only useful for users, but also
              ;; useful to implement parts of SBCL itself, so we're
index 46721e8..e92af31 100644 (file)
               (reader-error-format-arguments condition)
               (reader-impossible-number-error-error condition))))))
 
-;;; should this inherit from error?  good question
-(define-condition timeout (error) ())
+(define-condition sb!ext::timeout (serious-condition) ())
 
 
 \f
index 34629f5..f583403 100644 (file)
 (defun sigalrm-handler (signal info context)
   (declare (ignore signal info context))
   (declare (type system-area-pointer context))
-  (cerror "Continue" 'sb!kernel::timeout))
-
+  (cerror "Continue" 'sb!ext::timeout))
 
 (defun sigquit-handler (signal code context)
   (declare (ignore signal code context))
index 4dce234..7f71780 100644 (file)
                        (slot (slot itvo 'it-value) 'tv-usec))
                which (alien-sap (addr itvn))(alien-sap (addr itvo))))))
 
-(defmacro with-timeout (expires &body body)
+(defmacro sb!ext::with-timeout (expires &body body)
   "Execute the body, interrupting it with a SIGALRM after at least
 EXPIRES seconds have passed.  Uses Unix setitimer(), restoring any
 previous timer after the body has finished executing"
index d3efee8..2029247 100644 (file)
@@ -40,6 +40,7 @@
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <linux/version.h>
 
 #include "validate.h"
 #include "thread.h"
@@ -47,33 +48,35 @@ size_t os_vm_page_size;
 
 #include "gc.h"
 \f
+int linux_sparc_siginfo_bug = 0;
 
-#ifdef sparc
-int early_kernel = 0;
-#endif
 void os_init(void)
 {
-    /* Early versions of Linux don't support the mmap(..) functionality
-     * that we need. */
+    /* Conduct various version checks: do we have enough mmap(), is
+     * this a sparc running 2.2, can we do threads? */
     {
         struct utsname name;
        int major_version;
-#ifdef sparc
        int minor_version;
-#endif
+       char *p;
        uname(&name);
-       major_version = atoi(name.release);
-       if (major_version < 2) {
-           lose("linux major version=%d (can't run in version < 2.0.0)",
+       p=name.release;  
+       major_version = atoi(p);
+       p=strchr(p,'.')+1;
+       minor_version = atoi(p);
+       if (major_version<2) {
+           lose("linux kernel version too old: major version=%d (can't run in version < 2.0.0)",
                 major_version);
        }
-#ifdef sparc
-       /* KLUDGE: This will break if Linux moves to a uname() version number
-        * that has more than one digit initially -- CSR, 2002-02-12 */
-       minor_version = atoi(name.release+2);
-       if (minor_version < 4) {
-           FSHOW((stderr,"linux minor version=%d;\n enabling workarounds for SPARC kernel bugs in signal handling.\n", minor_version));
-           early_kernel = 1;
+#ifdef LISP_FEATURE_SB_THREAD
+       if ((major_version <2) || (major_version==2 && minor_version < 4)) {
+           lose("linux kernel 2.4 required for thread-enabled SBCL");
+       }
+#endif
+#ifdef LISP_FEATURE_SPARC
+       if ((major_version <2) || (major_version==2 && minor_version < 4)) {
+           FSHOW((stderr,"linux kernel %d.%d predates 2.4;\n enabling workarounds for SPARC kernel bugs in signal handling.\n", minor_version));
+           linux_sparc_siginfo_bug = 1;
        }
 #endif
     }
index 5c825ad..e68eca5 100644 (file)
@@ -25,7 +25,7 @@
 #include "monitor.h"
 
 #ifdef LISP_FEATURE_LINUX
-extern int early_kernel;
+extern int linux_sparc_siginfo_bug;
 #endif
 
 void arch_init(void)
@@ -192,7 +192,7 @@ static void sigill_handler(int signal, siginfo_t *siginfo, void *void_context)
     
     if ((siginfo->si_code) == ILL_ILLOPC
 #ifdef LISP_FEATURE_LINUX
-       || (early_kernel && (siginfo->si_code == 2))
+       || (linux_sparc_siginfo_bug && (siginfo->si_code == 2))
 #endif
        ) {
        int trap;
@@ -241,7 +241,7 @@ static void sigill_handler(int signal, siginfo_t *siginfo, void *void_context)
     }
     else if ((siginfo->si_code) == ILL_ILLTRP
 #ifdef LISP_FEATURE_LINUX
-            || (early_kernel && (siginfo->si_code) == 192)
+            || (linux_sparc_siginfo_bug && (siginfo->si_code) == 192)
 #endif
             ) {
        if (pseudo_atomic_trap_p(context)) {
index 83b252a..8319e89 100644 (file)
@@ -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.pre8.108"
+"0.pre8.109"