From owner-freebsd-current Sun Jul 14 1:24:17 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 46D8037B400; Sun, 14 Jul 2002 01:24:14 -0700 (PDT) Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7ACD43E3B; Sun, 14 Jul 2002 01:24:13 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0078.cvx40-bradley.dialup.earthlink.net ([216.244.42.78] helo=mindspring.com) by harrier.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17Tefo-0007EJ-00; Sun, 14 Jul 2002 01:24:10 -0700 Message-ID: <3D3134EC.323F8B54@mindspring.com> Date: Sun, 14 Jul 2002 01:23:08 -0700 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Luigi Rizzo Cc: current@freebsd.org Subject: Re: different packing of structs in kernel vs. userland ? References: <20020714011810.A72236@iguana.icir.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Luigi Rizzo wrote: > Hi, > the following message seems to suggest that the compiler > (the way it is invoked) packs structures differently > when building the kernel and userland. > > The stize of the structure in question is computed > by both kernel and userland app using sizeof(), > so there is no assumption on the size of its members, > so i believe the only possibility of a mismatch is > the one above. > > Any ideas ? Probably a #pragma pack() in scope. Add one explicitly before and after the structure definition to force it to be the same in user space and the kernel, e.g.: #pragma pack(1) /* 1 byte packing */ struct foo { ... }; #pragma pack() /* whatever it was before */ The latter is like a "pop" of the former's "push", so you should be OK, even though it looks like what is happening is an include of an include file in the wrong place or in code that has one in scope. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message