Subject: Re: CMSG_ALIGN
To: None <tech-net@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 06/27/2003 19:33:08
>>>> Why not, instead, have the kernel increase the cmsg_len values to
>>>> whatever boundary it thinks appropriate?
> cmsg is bidirectional. when userland passes cmsg to kernel, we can
> not do such trick (userland does not know what kind of alignment
> kernel wants), so __cmsg_alignbytes is there for you.
Yessss...but should the kernel be counting on userland to do any
alignment? IMO it shouldn't be; it should be obeying cmsg_len values
and, if the value isn't aligned the way it (the kernel) wants, copying.
Again, no need for CMSG_ALIGN.
I think that having bytes in the control data buffer that aren't
accounted for by some item's cmsg_len is a Very Bad Idea. Aligning is
not unreasonable, but the alignment should be added into cmsg_len! (I
also think that alignment should never be _required_, that if the
receiver doesn't like the alignment provided, it's up to the receiver
to copy the data. But that is, strictly speaking, a separate issue.)
Is there any real spec for the control stuff? The only doc I've ever
found on it was source code, and searching the source tree for SCM_, I
don't find anything but source. A few manpages mention a few of the
possible things that can appear in the control data, but I couldn't
find any spec on things like CMSG_ALIGN.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B