Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Jan 2004 21:14:10 +0100
From:      des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To:        alpha@freebsd.org
Subject:   structure padding
Message-ID:  <xzpoete42r1.fsf@dwp.des.no>

next in thread | raw e-mail | index | archive | help
In -STABLE, struct kinfo_proc is currently defined as follows:

struct kinfo_proc {
	struct	proc kp_proc;
	struct	eproc {
                /* ... */
		char	e_login[roundup(MAXLOGNAME, sizeof(long))];
		long	e_spare[2];
	} kp_eproc;
};

I want to add an e_sid field to hold the process's session ID:

struct kinfo_proc {
	struct	proc kp_proc;
	struct	eproc {
                /* ... */
		char	e_login[roundup(MAXLOGNAME, sizeof(long))];
                pid_t   e_sid;
		long	e_spare[1];
	} kp_eproc;
};

However, a pid_t is an int, and sizeof int !=3D sizeof long on Alpha.
I'm not sure what will happen: will alignment rules cause gcc to add
four bytes of padding before e_spare, conserving the size of struct
kinfo_proc, or will struct kinfo_proc shrink by four bytes?

DES
--=20
Dag-Erling Sm=F8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpoete42r1.fsf>