Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Aug 2001 06:48:54 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Julian Elischer <julian@elischer.org>
Cc:        Brian Somers <brian@Awfulhak.org>, Thomas Pornin <Thomas.Pornin@ens.fr>, <freebsd-net@FreeBSD.ORG>, <freebsd-alpha@FreeBSD.ORG>, Brian Somers <brian@freebsd-services.com>, <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject:   Re: kern/27767: (was: PPPoE + Alpha + 32/64 bits)
Message-ID:  <20010803054935.M2890-100000@besplex.bde.org>
In-Reply-To: <Pine.BSF.4.21.0108021338320.41008-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2 Aug 2001, Julian Elischer wrote:

> care to explain?

Please trim quotes and reply after the quoted section[s].

> On Fri, 3 Aug 2001, Bruce Evans wrote:
> > > On Wed, 1 Aug 2001, Brian Somers wrote:
> > > > @@ -910,7 +910,7 @@
> > > >  	struct {
> > > >  		struct pppoe_tag hdr;
> > > >  		union	uniq	data;
> > > > -	} uniqtag;
> > > > +	} __attribute ((packed)) uniqtag;
> > > >  	negp			neg = NULL;
> > > >  	struct mbuf		*m;
> >
> > Obviously a syntax error.

`__attribute ((packed))' is a syntax error in Standard C.

Dependencies on compiler features are supposed to be centralized in
places like <sys/cdefs.h>.  Many invocations of __attribute__(()) are
placed there.  This is not possible for the `packed' attribute because
this attribute has non-cosmetic effects.  Structs must be carefully
laid out to give some chance of them not having any internal padding
for any compiler.  This sometimes involves using struct members with
an unnatural type.  <fs/msdosfs/bpb.h> has many examples.

Here I don't see how packing the struct helps on alphas.  Doesn't it
cause traps by misaligning uniqtag.data.pointer?  I think you need
something like:

  	struct {
		struct	pppoe_tag hdr;
 		char	data[sizeof(void *)];
	} uniqtag;
	void *pointer;
	...
	pointer = sp;
	memcpy(uniqtag.data, &pointer, sizeof(uniqtag.data));

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




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