[Top][All Lists]

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

Re: getprogname fails randomly on PA-RISC HPUX 11.11 with 64-bit kernel

From: John David Anglin
Subject: Re: getprogname fails randomly on PA-RISC HPUX 11.11 with 64-bit kernel
Date: Wed, 22 Sep 2021 16:55:59 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 2021-09-22 3:49 p.m., Bruno Haible wrote:
> Hi John Dave,
> According to
> https://en.wikipedia.org/wiki/HP-UX#Version_history
> versions < 11.31 of HP-UX are already past end-of-support for more than
> 5 years. The only possibly relevant HP-UX version nowadays is 11.31.
> Therefore I would not want to spend time on the earlier versions.
> We have already declared HP-UX as being unsupported in Gnulib:
> https://www.gnu.org/software/gnulib/manual/html_node/Formerly-Supported-Platforms.html
> (The reason is that I no longer have access to an HP-UX machine.)
> But if you come up with reasonable patches for HP-UX 11.31 and actively
> maintain this configuration (e.g. through regular builds of gnulib testdirs
> or coreutils or such), we might add it back into the category of supported
> platforms.

At this time, I don't have access to 11.31.  I have a rp3440 which could run 
11.31 but at
the moment it is dedicated to supporting Debian Linux.  Have a c8000 which can 
either 11.11 or Linux.
> Regarding this particular patch:
>> --- getprogname.c.save       2021-09-19 15:28:26 +0000
>> +++ getprogname.c    2021-09-22 13:35:07 +0000
>> @@ -155,7 +155,12 @@
>>               as above, but in a compilation unit where '#define _PSTAT64 1'
>>               is in effect.  I prefer a single compilation unit; the struct
>>               size and the offsets are not going to change.  */
>> +#    ifdef __hppa__
>> +          char status64[1176];
>> +#    else
>>            char status64[1216];
>> +#    endif
>> +          int __pstat_getproc64 (char *, size_t, size_t, int);
>>            if (__pstat_getproc64 (status64, sizeof status64, 0, pid) > 0)
>>              {
>>                char *ucomm = status64 + 288;
> Are you sure the struct size depends on the CPU type, not on the HP-UX 
> version?
> (I don't remember whether I tested this on both HPPA and IA64 hardware.)
> And are you sure the offsets are correct in the smaller struct?
I don't know whether the problem is CPU type or HP-UX version.  If the code 
depends on CPU type,
that would mean binaries would not be forward compatible.

I checked the offsets.  They are correct.
> Not being sure, it would be more maintainable to move this code into a
> separate compilation unit, getprogname-hpux32.c, which would define
> _PSTAT64 to 1 before including the system headers.
Defining _PSTAT64 works for me as all the machines that I have can run 64-bit 
kernels.  My initial
patch was just to define _PSTAT64 before the headers are included:

#ifdef __hpux
# ifndef __LP64__
    /* Wide _PSTAT64 interface must be used when using 64-bit kernel.  */
#   define _PSTAT64
# endif
# include <unistd.h>
# include <sys/param.h>
# include <sys/pstat.h>
# include <string.h>

The __pstat_getproc64 hunk then isn't needed.  There could be a configure check 
using getconf KERNEL_BITS
so the code would work with a 32-bit kernel.  But then binaries depend on CPU 


John David Anglin  dave.anglin@bell.net

reply via email to

[Prev in Thread] Current Thread [Next in Thread]