Subject: Re: CMSG_ALIGN
To: None <itojun@iijlab.net, tech-net@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 06/28/2003 00:06:52
>> So that, for example, a cmsg_len that's natively 20 would be
>> increased to 24 by the kernel (probably in recvit()'s loop), so that
>> cmsg_len is _always_ the right amount for userland to advance its
>> pointer by?
> 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),

Yes...but there's no reason it has to.  If userland doesn't align it to
whatever alignment the kernel wants, the kernel should copy it.  (It
has to be prepared to copy it anyway, if only because the buffer itself
might not be aligned.  Arguably it would be wrong to use it directly
out of userland memory anyway, meaning it would always get copied - I
note that the code currently copies it always.)

/~\ 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