j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:

> Hi folks,
>
> here's a diff to correct sbcl's assumptions about struct timeval on
> OpenBSD i386.  The second build just ended, quick testing shows no
> regression.  I've refreshed the existing patches while here.
>
> ok?

For ease of proof-reading, here's the fix with more context lines:

--- src/code/unix.lisp.orig     Sun Jun  2 15:12:40 2013
+++ src/code/unix.lisp  Sun Sep 15 17:06:09 2013
@@ -208,30 +208,33 @@
 ;; A time value that is accurate to the nearest
 ;; microsecond but also has a range of years.
 ;; CLH: Note that tv-usec used to be a time-t, but that this seems
 ;; problematic on Darwin x86-64 (and wrong). Trying suseconds-t.
 #!-(or win32 openbsd netbsd)
 (define-alien-type nil
   (struct timeval
           (tv-sec time-t)           ; seconds
           (tv-usec suseconds-t)))   ; and microseconds
 
-;; The above definition doesn't work on 64-bit OpenBSD platforms.
-;; Both tv_sec and tv_usec are declared as long instead of time_t, and
-;; time_t is a typedef for int.
-#!+(or openbsd netbsd)
+;; The following definition was used on OpenBSD pre-5.5.
+;; Both tv_sec and tv_usec were declared as long instead of time_t, and
+;; time_t was a typedef for int.
+;; Note: time_t is 64-bit on all architectures, starting from OpenBSD 5.5.
+;; FIXME: it seems recent NetBSD releases use a 64-bit time_t too.
+#!+netbsd
 (define-alien-type nil
   (struct timeval
           (tv-sec long)             ; seconds
           (tv-usec long)))          ; and microseconds
 
-#!+win32
+;; OpenBSD 5.5 uses this struct layout.
+#!+(or win32 openbsd)
 (define-alien-type nil
   (struct timeval
           (tv-sec time-t)           ; seconds
           (tv-usec long)))          ; and microseconds
 
 ;;;; resourcebits.h
 
 (defconstant rusage_self 0) ; the calling process
 (defconstant rusage_children -1) ; terminated child processes
 (defconstant rusage_both -2)
@@ -941,20 +944,22 @@
 ;; timeval" but has nanoseconds instead of microseconds.
 #!-(or openbsd netbsd)
 (define-alien-type nil
     (struct timespec
             (tv-sec long)   ; seconds
             (tv-nsec long))) ; nanoseconds
 
 ;; Just as with struct timeval, 64-bit OpenBSD has problems with the
 ;; above definition.  tv_sec is declared as time_t instead of long,
 ;; and time_t is a typedef for int.
+;; Note: time_t is 64-bit on all architectures, starting from OpenBSD 5.5
+;; FIXME: it seems recent NetBSD releases use a 64-bit time_t too.
 #!+(or openbsd netbsd)
 (define-alien-type nil
     (struct timespec
             (tv-sec time-t)  ; seconds
             (tv-nsec long))) ; nanoseconds
 
 ;; used by other time functions
 (define-alien-type nil
     (struct tm
             (tm-sec int)   ; Seconds.   [0-60] (1 leap second)

Reply via email to