From fe240ce504041bfb181a81cb11b7b4bba112f65f Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 26 Apr 2003 22:32:27 +0000 Subject: [PATCH] 0.pre8.109 #+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 | 3 ++- src/code/condition.lisp | 3 +-- src/code/target-signal.lisp | 3 +-- src/code/unix.lisp | 2 +- src/runtime/linux-os.c | 37 ++++++++++++++++++++----------------- src/runtime/sparc-arch.c | 6 +++--- version.lisp-expr | 2 +- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr index 7ec97a8..be590dc 100644 --- a/package-data-list.lisp-expr +++ b/package-data-list.lisp-expr @@ -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 diff --git a/src/code/condition.lisp b/src/code/condition.lisp index 46721e8..e92af31 100644 --- a/src/code/condition.lisp +++ b/src/code/condition.lisp @@ -767,8 +767,7 @@ (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) ()) diff --git a/src/code/target-signal.lisp b/src/code/target-signal.lisp index 34629f5..f583403 100644 --- a/src/code/target-signal.lisp +++ b/src/code/target-signal.lisp @@ -118,8 +118,7 @@ (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)) diff --git a/src/code/unix.lisp b/src/code/unix.lisp index 4dce234..7f71780 100644 --- a/src/code/unix.lisp +++ b/src/code/unix.lisp @@ -760,7 +760,7 @@ (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" diff --git a/src/runtime/linux-os.c b/src/runtime/linux-os.c index d3efee8..2029247 100644 --- a/src/runtime/linux-os.c +++ b/src/runtime/linux-os.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "validate.h" #include "thread.h" @@ -47,33 +48,35 @@ size_t os_vm_page_size; #include "gc.h" +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 } diff --git a/src/runtime/sparc-arch.c b/src/runtime/sparc-arch.c index 5c825ad..e68eca5 100644 --- a/src/runtime/sparc-arch.c +++ b/src/runtime/sparc-arch.c @@ -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)) { diff --git a/version.lisp-expr b/version.lisp-expr index 83b252a..8319e89 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.pre8.108" +"0.pre8.109" -- 1.7.10.4