Date: Thu, 1 Jul 2004 20:28:10 +0100 From: Anil Madhavapeddy <anil@recoil.org> To: Julian Elischer <julian@elischer.org> Cc: freebsd-net@lists.freebsd.org Subject: Re: Packing netgraph structs Message-ID: <C98C976C-CB94-11D8-99F8-000A95DA50A6@recoil.org> In-Reply-To: <Pine.BSF.4.21.0407011013450.91303-100000@InterJet.elischer.org> References: <Pine.BSF.4.21.0407011013450.91303-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1 Jul 2004, at 18:20, Julian Elischer wrote: > > are syscall arguments packed? I know that they are defined rather > strangely.. On OpenBSD at least, they are wrapped in unions to pad them to register sizes. > > what messages are you having troubles with? > > Usually, in my experience, 'packed' structures are limitted to > structures that are defined in hardware, and message structures ae > defined unpacked so that they can be efficiently passed around within a > single system. > Can you give me better examples.. > I'm also a little worried about architectures that have certain > allignment restrictions on data, which is why packed and unpacked > structures are different in the first place. I'm just looking for a non-fragile way to create the structure specified by Netgraph without actually using C. Of course, I can create a whole bunch of C structs using the local compiler and mirror OCaml functions, but it's an inelegant solution. As others have helpfully pointed out, the current struct has been carefully designed to work well on existing architectures without the compiler padding (in particular, it looks like it will work on ARM which requires structs to be multiples of word size), and my initial tests have worked fine on i386. Just wondering if others have come up with a better solution than a large set of FFI bindings. -- Anil Madhavapeddy http://anil.recoil.org University of Cambridge http://www.cl.cam.ac.uk
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C98C976C-CB94-11D8-99F8-000A95DA50A6>