From owner-freebsd-hackers Thu Jun 19 19:54:41 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id TAA05563 for hackers-outgoing; Thu, 19 Jun 1997 19:54:41 -0700 (PDT) Received: from fallout.campusview.indiana.edu (fallout.campusview.indiana.edu [149.159.1.1]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id TAA05282; Thu, 19 Jun 1997 19:48:40 -0700 (PDT) Received: from localhost (jfieber@localhost) by fallout.campusview.indiana.edu (8.8.5/8.8.5) with SMTP id UAA05312; Thu, 19 Jun 1997 20:53:47 -0500 (EST) Date: Thu, 19 Jun 1997 20:53:46 -0500 (EST) From: John Fieber Reply-To: John Fieber To: brian@awfulhak.org, brian@utell.co.uk cc: jmz@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: realloc() quirk (was: Re: xperfmon++ problem (again)) In-Reply-To: <199706191725.SAA00390@utell.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Thu, 19 Jun 1997, Brian Somers wrote: [Way to many quotes to get straight, so I won't even try.] > >>>> > Sorry. I was doing this from memory. The message was > >>>> > > >>>> > Error: Cannot perform realloc > >>>> > >>>> Well, i was checking all ``Cannot'' messages in the source, and none > >>>> didn't come close to what you've mentioned. [snip] > >>> [pozzo:/usr/home/mefoster] strings /usr/X11R6/lib/libXt.so.6.0 | grep > >>> perform > >>> Cannot perform %s [snip] > >> Ouch. I just built XFree86-3.3, and I'm now getting this from knews. > >> I rebuilt knews too - no change. > >> > >> It happens just after I press the post key !!!!!! [snip] > > Well, xc/lib/Xt/Alloc.c does the realloc (in function XtRealloc). > > I changed the diagnostic so that it says how much we're allocating, > > and it comes out as zero ! Ah ha ! [snip] > > Now this is *really* bad news AFAIK. X provides the following in > > FreeBSD.cf: > > #define Malloc0ReturnsNull NO [snip] > FWIW, this is the patch - it solves my knews problem, but isn't > *really* the right answer :| Copy it to > /usr/ports/x11/XFree86/patches/patch-af, and just "make". The problem is that malloc(0) and realloc(ptr, 0) behave differently but X assumes they behave the same. This was fixed recently in -current but phk has not (that I noticed) committed it to RELENG_2_2. However, I grabbed malloc.c from -current and re-built my 2.2.1 libc and both knews and xperfmon++ work fine. I think this is a pretty important thing to get fixed in RELENG_2_2. It might even be worthwhile to make updated copies of libc available to people who can't easily upgrade or rebuild their libc. -john