[comp.sys.hp] X11R4 under HP-UX 7.0

dgreen@monet.watson.ibm.com (Dan Greening) (03/03/90)

mark@comp.vuw.ac.nz (Mark Davies) writes in comp.windows.x:

> Has anyone build R4 under HP-UX 7.0 on a series 300 machine?
> 
> Everything built and worked fine under 6.5.
> Under 7.0 everything builds without complaint (except for warnings because
> SIGCHLD is now defined in signal.h), the server works, some of the clients
> work, but other clients (notably xterm, xman, xcalc, xdm) fail immediately
> with the message:
> 
> Cannot perform realloc
> 
> (from lib/Xt/Alloc.c)
> There should be plenty of swap space (the 6.5 built clients work in the
> same circumstances).
> 
> The only thing I changed (apart from the operating system :-) was in
> config/hp.cf change the OSName etc to:
> #define OSName                 HP-UX 7.0
> #define OSMajorVersion         7
> #define OSMinorVersion         0
> 
> Any ideas what is going on?
> 
> cheers
> mark

This is exactly the problem I had.  A similar problem was reported to me
by a colleague at Washington State University.  I posted a request for 
help to comp.sys.hp about three weeks ago.  I received this response from
Kris Olander, who runs on a 9000/340:

> I've compiled X11R4 (with patched through fix-2) with very few
> difficulties.   I wasn't able to startup X fresh from compiling until
> I made /usr/bin/X a soft link to /usr/bin/Xhp, chmod 2755 on Xhp,xterm,
> and xload, and finally, chgrp sys Xhp,xterm,xload.

It was the only helpful response I've received.  HP techs told me "gosh,
I thought everything worked in HP 7.0 :-)" and that was about it.
I have not been able to test this solution, since I am now physically
distant from the HP machines I help administer.  

IF THE ABOVE METHOD SOLVES THE "Cannot perform realloc" PROBLEM, COULD
SOMEONE PLEASE LET ME KNOW BY E-MAIL?  Thanks.

Dan R. Greening		12 Foster Court			NY (914) 789-7860
dgreen@cs.ucla.edu	Croton-on-Hudson, NY 10520	CA (213) 825-2266

mark@comp.vuw.ac.nz (Mark Davies) (03/04/90)

I write about X clients failing under HP-UX 7.0 with:
	 Cannot perform realloc

In article <1990Mar2.185840.24495@arnor.uucp> dgreen@cs.ucla.edu writes:
>This is exactly the problem I had.  A similar problem was reported to me
>by a colleague at Washington State University.  I posted a request for 
>help to comp.sys.hp about three weeks ago.  I received this response from
>Kris Olander, who runs on a 9000/340:

>> I've compiled X11R4 (with patched through fix-2) with very few
>> difficulties.   I wasn't able to startup X fresh from compiling until
>> I made /usr/bin/X a soft link to /usr/bin/Xhp, chmod 2755 on Xhp,xterm,
>> and xload, and finally, chgrp sys Xhp,xterm,xload.

>IF THE ABOVE METHOD SOLVES THE "Cannot perform realloc" PROBLEM, COULD
>SOMEONE PLEASE LET ME KNOW BY E-MAIL?  Thanks.

No it doesn't.

The correct fix came from Bob May <bobm@hpcvlx.cv.hp.com> in article
<100920183@hpcvlx.cv.hp.com> in comp.windows.x.

Seems under 7.0 you need to define MALLOC_0_RETURNS_NULL.
I did this and everything now works smoothly.

cheers
mark

andreas@hpcvlx.cv.hp.com (Jim Andreas) (03/18/90)

Regarding the:

    cannot perform realloc

problem in clients in MIT X11R4:

Yes the True Answer is to define MALLOC_0_RETURNS_NULL
when you compile your libs.  Here is the relevant code
fragment from Xlibos.h in MIT X11R4 (./mit/lib/X/Xlibos.h):

/*
 * Note that some machines do not return a valid pointer for malloc(0), in
 * which case we provide an alternate under the control of the
 * define MALLOC_0_RETURNS_NULL.  This is necessary because some
 * Xlib code expects malloc(0) to return a valid pointer to storage.
 */
#ifdef MALLOC_0_RETURNS_NULL

# define Xmalloc(size) malloc(((size) > 0 ? (size) : 1))
# define Xrealloc(ptr, size) realloc((ptr), ((size) > 0 ? (size) : 1))
# define Xcalloc(nelem, elsize) calloc(((nelem) > 0 ? (nelem) : 1), (elsize))

#else

# define Xmalloc(size) malloc((size))
# define Xrealloc(ptr, size) realloc((ptr), (size))
# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))

#endif
-----------------------------------------------------------------------
Jim Andreas             | andreas@cv.hp.com                | INTERNET
Hewlett-Packard Company | {backbone}!hplabs!hp-pcd!andreas | UUCP
1000 N.E. Circle        | (USA) (503) 750-2860             | VOICE
Corvallis, OR 97330     | (USA) (503) 750-3788             | FAX  
-----------------------------------------------------------------------
This response does not represent the official position of, or statement by,
the Hewlett-Packard Company.  The above data is provided for informational
purposes only.  It is supplied without warranty of any kind.
-----------------------------------------------------------------------