Subject: Re: ancillary data alignment and binary backward compatibility: please pick one
To: Matt Thomas <firstname.lastname@example.org>
From: None <email@example.com>
Date: 03/01/2000 00:00:34
>> so, will the emulation layer would change alignment constraints on
>> all the data on routing socket? hmm, I see I'm relieved.
>Yes. (or rather it should)
>> back to the original question (CMSG_ALIGN), which one do you prefer?
>The first one. It's simpler.
in RFC2292 there is description like this:
> unsigned int CMSG_SPACE(unsigned int length);
> This macro is new with this API. Given the length of an ancillary
> data object, CMSG_SPACE() returns the space required by the object
> and its cmsghdr structure, including any padding needed to satisfy
> alignment requirements. This macro can be used, for example, to
> allocate space dynamically for the ancillary data. This macro should
> not be used to initialize the cmsg_len member of a cmsghdr structure;
> instead use the CMSG_LEN() macro.
Which bullet is more correct? If the former, we can pick freely from
two candidates we have. If the latter, we must pick the first
- CMSG_SPACE() is for dynamic allocation only, i.e.
p = malloc(CMSG_SPACE(int));
- CMSG_SPACE() can be used for static allocations, like:
static char buf[CMSG_SPACE(int)];
(thanks soda for notifying me of the sentences)