[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#44654: dpkg: seg faults w/2.3.17; problem traced to sysinfo()



On Sep 10, Alan Cox wrote:
> > I suggest also to put back the comment about the 64byte alignment.
> > 
> > --- 2.3.17/include/linux/kernel.h	Wed Sep  8 18:18:56 1999
> > +++ kernel.h	Fri Sep 10 02:32:45 1999
> > @@ -96,7 +96,8 @@
> >  	unsigned short procs;		/* Number of current processes */
> >  	unsigned long totalbig;		/* Total big memory size */
> >  	unsigned long freebig;		/* Available big memory size */
> > -	char _f[22-2*sizeof(long)];	/* Padding: libc5 uses this.. */
> > +	char _f[12];			/* Pads structure to 64 bytes
> > +					   (libc5 uses this..) */
> >  };
> >  
> >  #endif
> > 
> > Andrea
> 
> That is trivially and obviously wrong. You have to do the sizeof check
> because of 64bit machines

It looks like we need something like:

unsigned short procs;
unsigned short unused;
unsigned long totalbig;
unsigned long freebig;
char _f[22-2*sizeof(long)-sizeof(short)];

This explicitly includes the alignment in the structure, which IMHO is
a good thing.  Yes, I know _f[] looks ugly.  Oh, well.  (I assume
unsigned short is usually 32 bits on a 64-bit platform, so the
alignment will be fixed here... otherwise, damned if I know how to
portably fix the problem.)


Chris
-- 
=============================================================================
|        Chris Lawrence         |        Get your Debian 2.1 CD-ROMs        |
|   <quango@watervalley.net>    |         http://www.lordsutch.com/         |
|                               |                                           |
|    Amiga A4000 604e/233Mhz    |    This address has been spam-proofed.    |
|     with Linux/APUS 2.2.8     |     All spam goes to your postmaster.     |
=============================================================================


Reply to: