<div dir="ltr"><div>> as long as ... I don't expect this to be a problem</div><div><br></div><div>I've seen it be a problem.</div><div><br></div>I recommend the following paranoia checking regarding the shm buffer:<br>- do not use time_t or ints directly, but cast to the "Exact width" integer types defined in stdint.h<br>  see <a href="https://en.wikipedia.org/wiki/C_data_types#Fixed-width_integer_types">https://en.wikipedia.org/wiki/C_data_types#Fixed-width_integer_types</a><br><div>- 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</div><div><br></div><div>..m</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 13, 2016 at 3:49 AM Eric S. Raymond <<a href="mailto:esr@thyrsus.com">esr@thyrsus.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hal Murray <<a href="mailto:hmurray@megapathdsl.net" target="_blank">hmurray@megapathdsl.net</a>>:<br>
> Are we interested in any systems with 32 bit time_t?<br>
> Do all the systems we are interested in put 64 bit things on 8 byte<br>
> boundaries?<br>
<br>
All the systems we are interested in use self-alignment rules, so yes to<br>
the second question.<br>
<br>
If you want full details on how to compute alignment and packing, see<br>
<a href="http://www.catb.org/esr/structure-packing" rel="noreferrer" target="_blank">http://www.catb.org/esr/structure-packing</a> . The Linux/GCC combination<br>
has one odd exception to self-alignent near floats the isn't relevant here.<br>
There are some tricky details about trailing padding on struct members.<br>
<br>
We might be interested in supporting some 32-bit embedded systems.  As long<br>
as both sides of the SHM exchage were compiled 32-bit I don't expect this to<br>
be a problem.<br>
--<br>
                <a href="<a href="http://www.catb.org/~esr/" rel="noreferrer" target="_blank">http://www.catb.org/~esr/</a>">Eric S. Raymond</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@ntpsec.org" target="_blank">devel@ntpsec.org</a><br>
<a href="http://lists.ntpsec.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ntpsec.org/mailman/listinfo/devel</a><br>
</blockquote></div>