On 1 Jul 2004, at 15:10, Ruslan Ermilov wrote:
We use Netgraph from within Python, using the netgraph(3) library, and we pack/unpack various Netgraph related structs just happily.
Speaking of "struct ng_mesg", if you pack it, it will essentially stay the same, because I believe it was created with this in mind, as well as most if not all other user-accessible Netgraph structs.
How robust is this solution? Since ng_mesg uses nested structs, and compilers can insert padding at the end of structs at will, this could lead to padding between ng_mesg.header.cmdstr and ng_mesg.data. Alan Mycroft, who wrote the ARM C compiler commented that the C spec is rather ambiguous about padding, and that compilers are quite free to pad as they chose in between structs as well.
In other words - is there any harm in adding a packed attribute here to ensure this wont break and lead to hard to track down bugs in the future? It shouldn't even affect the gcc ABI I think ... ?
For the moment, I'll get on with just serialising as if it were optimally packed from OCaml, thanks for your help so far!
-- Anil Madhavapeddy http://anil.recoil.org University of Cambridge http://www.cl.cam.ac.uk
_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"