Subject: Re: process list within p_emuldata
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 07/04/2002 22:22:56
In article <1fetky8.17rl4wu1ap6zd4M%manu@netbsd.org>,
Emmanuel Dreyfus <manu@netbsd.org> wrote:
>While it's more a C language question than a kernel question, I don't see a
>better place for this question.
>
>In order to emulate IRIX share groups, I'd like to maintain an emulation
>specific process list:
>
>struct irix_emuldata {
>        LIST_ENTRY(proc) ied_list;
>}
>
>For an IRIX process, p->p_emuldata points to a struct irix_emuldata. Hence I
>can reach the list link like this:
>
>(struct irix_emuldata *)(p->p_emuldata)->ied_list
>
>Now I want ot use LIST_FOREACH on this...
>
>struct proc *pp;
>LIST_HEAD(isg_head, proc) isg_head; 
>LIST_FOREACH(pp, &isg_head, p_emuldata->ied_list)
>
>This won't work because I am dereferencing a (void *) pointer. 
>
>Things like this won't work either:
>LIST_FOREACH(pp, &isg_head, (struct irix_emuldata *)p_emuldata->ied_list)
>The macro expands into 
> pp = (pp->((struct irix_emuldata *)p_emuldata)->ie_list.le_next))
>and I just get a "parse error before `('"

LIST_FOREACH(((struct irix_emuldata *)pp->p_emuldata), &isg_head, ied_list)

or something along those lines.

christos