structure padding
John Baldwin
jhb at FreeBSD.org
Thu Jan 8 13:48:34 PST 2004
On Thursday 08 January 2004 04:28 pm, Dag-Erling Smørgrav wrote:
> John Baldwin <jhb at FreeBSD.org> writes:
> > Maybe:
> >
> > struct eproc {
> > union {
> > pid_t e_sid;
> > long e_oldspare;
> > }
> > long e_spare[1];
> >
> > (I think gcc supports anonymous unions like that.)
>
> I thought about that, but it's butt-ugly...
>
> Does anyone have an Alpha running 4.x that I could test this on?
>
> > In 6.0 you could remove the union hack and change the ABI, assuming that
> > you want to put this in 5.x as well.
>
> 5.x has a completely different struct kinfo_proc which already
> contains the session id.
Actually, why not just use a long for the e_sid instead of pid_t? A long will
certainly fit a pid_t. Doesn't hurt for it to be too big. So just:
char e_comm[]
long e_sid;
long e_spare;
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-alpha
mailing list