tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CMSG_SPACE: too clever by half?



On Thu, Feb 24, 2011 at 11:52:30AM -0500, Thor Lancelot Simon wrote:
> On Thu, Feb 24, 2011 at 07:13:20PM +0300, Alexander Nasonov wrote:
> > 24.02.2011, 19:06, "Julio Merino" <jmmv%NetBSD.org@localhost>:
> > > - Import tmux into src/external/bsd/tmux.
> > 
> > Please take a note on this NetBSD issue:
> > http://comments.gmane.org/gmane.comp.terminal-emulators.tmux.user/38
> 
> The issue involves the way we arranged for binary compatibility across
> changes in the unix-domain file descriptor and credentials passing code.

Correct.

> A macro, CMSG_SPACE(), is used to walk around the out-of-band data area
> used for these purposes.  On most operating systems it enforces a constant
> alignment at compile time, so it can be used to size local arrays.

It tends to work in GCC due to a very, very ugle hack where they defer
the size computation to runtime for the type as well.

> I would appreciate others' opinions on this.  I am pretty sure what we
> are doing now conforms to the standard but I still do not think it is
> a great thing to do.

I think the correct approach would be to have a second macro which gives
an upper bound on the required space. It doesn't have to be very tight,
but it has to be ICE.

This would also fix the postfix build with clang, for which I currently
have a local patch in my tree.

Joerg


Home | Main Index | Thread Index | Old Index