in reply to Sys::MemInfo on AIX

In this line from the make log:

/opt/tools/nagios/perl/bin/perl /opt/tools/nagios/perl/lib/5.2 +0.1/ExtUtils/xsubpp -noprototypes -typemap /opt/tools/nagiosc

the -typemap param of xsubpp specifies a file which contains data-type mappings between C and XS (see xsubpp). My default typemap file (in /usr/share/perl5/ExtUtils/typemap) starts with these:

# basic C types int T_IV unsigned T_UV unsigned int T_UV long T_IV unsigned long T_UV ...

The above command line specifies the typemap file to be /opt/tools/nagiosc. If this is indeed a file and a typemap file then you could try adding a line like this:

u_longlong_t T_UV

or, if indeed T_ULONGLONG exists in Perl,:

u_longlong_t T_ULONGLONG

The type u_longlong_t most likely refers to C's unsigned long long (a long is 4 bytes, this must be 8 but that's probably system dependent). And must be known to AIX as it is mentioned in libperfstat.h which contains the function signature for perfstat_memory_total() used by arch/aix.xs in Sys::MemInfo.

The XS files for other systems in Sys::Meminfo, e.g. linux.xs etc. use a double for the return type of the meminfo functions e.g. arch/linux.xs.

The quick hack would be to replace u_longlong_t with double in file arch/aix.xs

So, either get a typemap file which contains said datatype mapping (googling got me one for CORBA::omniORB at https://metacpan.org/source/HOUSEL/CORBA-omniORB-0.9/typemap) or replace mapping with a double like the other os's do and see if that works.

bw, bliako

Replies are listed 'Best First'.
Re^2: Sys::MemInfo on AIX
by rgren925 (Beadle) on Sep 04, 2018 at 20:14 UTC

    It worked!

    The change from u_longlong_t to double actually needed to be made in MemInfo.xs. All the platforms are now working.

    Thank you so much for this! Rick

      Cool!

      just test it so that you make sure you don't loose out on the conversion.

      Maybe the following C program will tell you the type sizes provided you manage to compile it:

      #include <stdio.h> #include <libperfstat.h> int main(void){ printf("double: %d bytes\n", sizeof(double)); printf("u_longlong_t: %d bytes\n", sizeof(u_longlong_t)); printf("unsigned long long: %d bytes\n", sizeof(unsigned long +long)); return(0); }

      Note: others here who do know the internals of Perl may have a better solution, if your application is critical.

      bw, bliako