Subject: Re: ancillary data alignment and binary backward compatibility
To: None <tech-net@netbsd.org>
From: None <itojun@iijlab.net>
List: tech-net
Date: 02/27/2000 20:05:09
>>> > 	- is hardcoded sizeof(long) alignment okay?
>>>Use the ALIGN() macro.
>>	IIRC ALIGN() was not usable for this, does not capture sparc64 case
>>	or something (maybe my memory is wrong).
>	I was wrong.  ALIGNBYTES in sparc64 looks okay.
>	ALIGNBYTES looks more correct than sizeof(long) - 1.  anyway, i'll
>	try to introduce sysctl for it...

	while I was trying to do this, I stuck with a problem.  I changed
	the definition for CMSG_ALIGN locally into this:
>#define CMSG_ALIGN(n)   (((n) + __cmsg_align()) & ~__cmsg_align())
	and made the code to grab kernel's idea about ALIGNBYTES via
	function __cmsg_align().  The function will grab sysctl hw.alignbytes
	MIB.

	Now, all CMSG_* macros are not constant.  Is it legal?
	If we change like this, we no longer be able to do the following:
>char foobaa[CMSG_SPACE(int)];

	Not sure which one is correct:
	- CMSG_SPACE must resolve into constant, so "char foobaa[...];"
	  is allowed.
	- there's no such requirement, programmer who wrote "char foobaa[...]"
	  is not correct.

	If you have any reference to standard/whatever, please give me some
	hints.   Thanks.

itojun