On Fri, Apr 16, 2010 at 11:31:54PM +0200, Tobias C. Rittweiler wrote:
> <rjs@...> writes:
> > Tom Ivar Helbekkmo wrote:
> >>rjs@... writes:
> >>> NetBSD-current now has 64 bit time_t which causes the problem you
> >>> are seeing.
> >>Does anyone have any thoughts about how complicated it will be to handle
> >>this? I've started looking at it, but my quick and dirty experimental
> >>modifications to src/code/unix.lisp just made things worse. :) I'll
> >>study the code more closely, but pointers and ideas will be appreciated.
> > This seems to help:
> > Index: unix.lisp
> > ===================================================================
> > RCS file: /cvsroot/sbcl/sbcl/src/code/unix.lisp,v
> > retrieving revision 1.105
> > diff -u -r1.105 unix.lisp
> > --- unix.lisp 19 Nov 2009 15:38:50 -0000 1.105
> > +++ unix.lisp 16 Apr 2010 20:28:29 -0000
> > @@ -808,7 +808,7 @@
> > (tm-zone c-string))) ; Timezone abbreviation.
> > (define-alien-routine get-timezone sb!alien:void
> > - (when sb!alien:long :in)
> > + (when time-t :in)
> > (seconds-west sb!alien:int :out)
> > (daylight-savings-p sb!alien:boolean :out))
> By chance, I've just had to look at the alien definition of TIMESPEC
> which is as follows:
> I do not understand why it's `long' in the first definition. My Linux
> Manpages refer to
> so shouldn't the second definition work ubiquitously?
> I'm particularly puzzled because output/stuff-groveled-from-headers.lisp
> (define-alien-type time-t (sb!alien:signed 32))
> which, if I'm not blatantly mistaken, is an `int' on Linux x86-32.
> And even more puzzling is that timedval is defined as follows:
> Which, now, is just the other way around comparing to the `timespec'
> definition above.
> I'm confused. Can anyone shed light on this issue?
Given the mess of reader conditionals to hard-code information for
various headers, wouldn't it be better to grovel information about the
structure at build time? It seems fairly straightforward to determine
the structure size as well as the offset, size, and even signedness of
structure members from a C program.