From 10a42ef2f761a76d07270f28d420771a8bbad96b Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 31 Jul 2009 09:42:20 +0000 Subject: [PATCH] 1.0.30.24: hopefully fix _long_ SLEEP issues on OpenBSD * OpenBSD refuses to nanosleep() over 100 million seconds (returning EINVAL), so loop with 100 million second sleeps till the time left is smaller than that. ...who knows, maybe there is a good reason to sleep over 3 years? Bug reported by Johsh Elsasser. --- NEWS | 2 ++ src/code/toplevel.lisp | 10 +++++++--- version.lisp-expr | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 0e3f455..838241b 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,8 @@ changes relative to sbcl-1.0.30: well. * improvement: improved address space layout on OpenBSD (thanks to Josh Elsasser) + * bug fix: SLEEP supports times over 100 million seconds on long on OpenBSD + as well. (reported by Josh Elsasser) * bug fix: DELETE-FILE on streams no longer closes the stream with :ABORT T, leading to possible attempts to delete the same file twice. See docstring on DELETE-FILE for details. (reported by John Fremlin) diff --git a/src/code/toplevel.lisp b/src/code/toplevel.lisp index 66b0b3f..0868844 100644 --- a/src/code/toplevel.lisp +++ b/src/code/toplevel.lisp @@ -174,9 +174,13 @@ any non-negative real number." (multiple-value-bind (sec frac) (truncate seconds) (values sec (truncate frac 1e-9)))) - ;; nanosleep accepts time_t as the first argument, - ;; so truncating is needed. 68 years on 32-bit platform should be enough - (sb!unix:nanosleep (min sec (1- (ash 1 (1- sb!vm:n-word-bits)))) nsec)) + ;; nanosleep() accepts time_t as the first argument, but on some platforms + ;; it is restricted to 100 million seconds. Maybe someone can actually + ;; have a reason to sleep for over 3 years? + (loop while (> sec (expt 10 8)) + do (decf sec (expt 10 8)) + (sb!unix:nanosleep (expt 10 8) 0)) + (sb!unix:nanosleep sec nsec)) #!+win32 (sb!win32:millisleep (truncate (* seconds 1000))) nil) diff --git a/version.lisp-expr b/version.lisp-expr index cd8b3db..b67bd8a 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".) -"1.0.30.23" +"1.0.30.24" -- 1.7.10.4