From owner-freebsd-alpha@FreeBSD.ORG Thu Jan 8 13:24:13 2004 Return-Path: Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AFD0416A4CE for ; Thu, 8 Jan 2004 13:24:13 -0800 (PST) Received: from mail3.speakeasy.net (mail3.speakeasy.net [216.254.0.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE95143D3F for ; Thu, 8 Jan 2004 13:24:11 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 7533 invoked from network); 8 Jan 2004 21:24:11 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 8 Jan 2004 21:24:11 -0000 Received: from 10.50.40.206 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i08LO1M4039230; Thu, 8 Jan 2004 16:24:07 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=), alpha@freebsd.org Date: Thu, 8 Jan 2004 15:42:49 -0500 User-Agent: KMail/1.5.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200401081542.49500.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) Subject: Re: structure padding X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2004 21:24:13 -0000 On Thursday 08 January 2004 03:14 pm, Dag-Erling Sm=F8rgrav wrote: > 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? Maybe: struct eproc { union { pid_t e_sid; long e_oldspare; } long e_spare[1]; (I think gcc supports anonymous unions like that.) In 6.0 you could remove the union hack and change the ABI, assuming that yo= u=20 want to put this in 5.x as well. =2D-=20 John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =3D http://www.FreeBSD.org