How big is time_t? Alignment?

Mark Atwood fallenpegasus at gmail.com
Sat May 14 03:23:37 UTC 2016


Ok, sigh, since we can't change the struct, we will live with it.

It may still make sense to do some int width and endian sanity testing.

And we can push changes to ntpsec and gpsd to use exact width integer types.



On Fri, May 13, 2016 at 8:18 PM Hal Murray <hmurray at megapathdsl.net> wrote:

>
> fallenpegasus at gmail.com said:
> > I recommend the following paranoia checking regarding the shm buffer: -
> do
> > not use time_t or ints directly, but cast to the "Exact width" integer
> types
> > defined in stdint.h
> >   see
> https://en.wikipedia.org/wiki/C_data_types#Fixed-width_integer_types -
> > add an 8 byte endian check array, cast from a int of that size, and
> write in
> > an int of the value 0x0102030405060708 or similar, to check endianness
>
> That would make sense if we were starting from scratch.
>
> The current status is that NTP Classic, NTPsec, and gpsd all use the same
> text to define the struct used in shared memory.  I don't think we should
> rock that boat.  This is by definition the way to do it, whatever the
> memory
> layout turns out to be.
>
>
>
> --
> These are my opinions.  I hate spam.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/devel/attachments/20160514/26f9f9c5/attachment.html>


More information about the devel mailing list