Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jun 1997 18:04:36 +0100 (BST)
From:      brian@utell.co.uk (Brian Somers)
Cc:        jmz@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: xperfmon++ problem (again)
Message-ID:  <199706191704.SAA24424@utell.co.uk>
References:  <33956BBB.1BB@nospam.com> <5n7bk7$osi@uriah.heep.sax.de> <339863C7.1DF5@nospam.com> <5nbrkn$2h6@uriah.heep.sax.de> <339D9548.7B07@nospam.com> <5ob5e7$31j@ui-gate.utell.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

[cc'd to jmz@FreeBSD.org (the XFree86 maintainer for FreeBSD)]
[cc'd to freebsd-hackers@FreeBSD.org]
[posted to comp.unix.bsd.freebsd.misc]

In article <5ob5e7$31j@ui-gate.utell.co.uk>,
	brian@shift.utell.net (Brian Somers) writes:
> In article <339D9548.7B07@nospam.com>,
> 	Marvin Foster <mefoster@nospam.com> writes:
>> J Wunsch wrote:
>>> 
>>> Marvin Foster <mefoster@nospam.com> wrote:
>>> 
>>> > 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.
>>> 
>>> Of course, there's a chance that it's a message from some X11 library.
>>> Sorry for not being more helpful, but all i can say is that it works
>>> for me (and used to work all the time).
>>> 
>>> --
>>> cheers, J"org
>>> 
>>> joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
>>> Never trust an operating system you don't have sources for. ;-)
>> 
>> I did the following:
>> 
>> [pozzo:/usr/home/mefoster] ldd /usr/X11R6/bin/xperfmon++
>> /usr/X11R6/bin/xperfmon++:
>>         -lXaw.6 => /usr/X11R6/lib/libXaw.so.6.1 (0x8022000)
>>         -lXt.6 => /usr/X11R6/lib/libXt.so.6.0 (0x8058000)
>>         -lXmu.6 => /usr/X11R6/lib/libXmu.so.6.0 (0x8099000)
>>         -lX11.6 => /usr/X11R6/lib/libX11.so.6.1 (0x80a9000)
>>         -lkvm.2 => /usr/lib/libkvm.so.2.0 (0x813f000)
>>         -lc.3 => /usr/lib/libc.so.3.0 (0x8143000)
>> [pozzo:/usr/home/mefoster]
>> [pozzo:/usr/home/mefoster] strings /usr/X11R6/lib/libXt.so.6.0 | grep
>> realloc
>> realloc
>> _realloc
>> [pozzo:/usr/home/mefoster] strings /usr/X11R6/lib/libXt.so.6.0 | grep
>> perform
>> Cannot perform %s
>> [pozzo:/usr/home/mefoster]
>> 
>> I'm sort of new to FreeBSD, and not very expert at unix debugging, but
>> I will keep looking into it and submit a problem report if I find
>> anything.
> 
> 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 !!!!!!
> 
> This is on a RELENG_2_2 machine built June 15.  Even setting
> /etc/malloc.conf to RAD doesn't yield any results - somethings
> lying - realloc didn't fail !  I'll post any findings.
> 
> Here goes again *cringe*

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 !

shift $ cd /tmp
shift $ cat >x.c <<eof
#include <string.h>
#include <stdio.h>
main()
{
    char *x = (char *)malloc(0);
    printf("%p\n", x);
    x = (char *)realloc(x,0);
    printf("%p\n", x);
    return 0;
}
eof
shift $ cc -o x x.c
shift $ ./x
0x4030
0x0
shift $

Now this is *really* bad news AFAIK.  X provides the following in
FreeBSD.cf:
#define Malloc0ReturnsNull      NO

but I don't know of any provisions for malloc returning a pointer
and realloc returning NULL :(

We could always do a simple patch to this file, but is this the
right way to go ?

-- 
Brian <brian@awfulhak.org> <brian@freebsd.org>
      <http://www.awfulhak.org>;
Don't _EVER_ lose your sense of humour !



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