tech-kern archive

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

Re: pserialize(9) vs. TAILQ



On 19 Nov, 2014, at 01:54 , Taylor R Campbell <campbell+netbsd-tech-kern%mumble.net@localhost> wrote:

>   Date: Wed, 19 Nov 2014 00:05:05 +0800
>   From: Dennis Ferguson <dennis.c.ferguson%gmail.com@localhost>
> 
>   Also, the TAILQ macros depend on a type pun fairly similar to the one
>   that did in the CIRCLEQ macros and hence have a lifetime which extends
>   only to some future version of the compiler smart enough to recognize
>   that and miscompile them.
> 
> What type pun is that?  I don't see it.

I think this one:

#define TAILQ_LAST(head, headname) \
	(*(((struct headname *)((head)->tqh_last))->tqh_last))
#define TAILQ_PREV(elm, headname, field) \
	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))

The (struct headname *) pointer it is obtaining by the cast is
sometimes being used to access data in something other than
a 'struct headname'.

Dennis Ferguson


Home | Main Index | Thread Index | Old Index