[Nagiosplug-devel] check_disk on AIX 5.1 ML04 needs "-maix64"

Paulo Afonso Graner Fessel paulo.fessel at primesys.com.br
Wed Sep 15 16:14:10 CEST 2004

Hi, folks.
Installing nagios-plugins-1.4.0a1 on AIX 5.1 ML04, I've found that it's
neccessary to configure the compilation with:
CFLAGS="-g -O2 -maix64" OBJECT_MODE=32_64 ./configure
Otherwise, check_disk will lock up and will not return even when run
without options. I've found that the problem is at lib/mountlist.c
around line 723:
for (thisent = entries; thisent < entries + bufsize;
         thisent += vmp->vmt_length)
After doing a little research on Google, I found that vmount as defined
in <sys/vmount.h> has a variable type definition:
struct vmount {
        uint    vmt_revision;   /* I revision level, currently 1
        uint    vmt_length;     /* I total length of structure and data
#if !defined(_KERNEL) && defined(__64BIT__)
        fsid64_t  vmt_fsid;     /* O id of file system
        fsid_t  vmt_fsid;       /* O id of file system
When compiled in 32-bit mode in an AIX 64-bit machine/os, vmt_length
turns out to be zero at some point - this is because vmt_fsid is 64-bit
and this is not taken into account by the plugin and its lower-order
bits are thrown out. After this point, thisent is not increased and we
get a infinite loop.
The solution is to use -maix64. According to gcc manual:
"Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
long type, and the infrastructure needed to support them. Specifying
-maix64 implies -mpowerpc64 and -mpowerpc, while -maix32 disables the
64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32."
Thus, with maix64 we compare again apples to apples, and check_disk
works without a hitch.
I don't know now what is easier:

1.	Modify ./configure to add -maix64 to CFLAGS whem using gcc (and
its xlC counterpart) when it knows that is running on a 64-bit machine; 
2.	Modify lib/mountlist.c to handle both situations.

Paulo Afonso Graner Fessel
Administrador de Ambiente e Sistemas UNIX
paulo.fessel at primesys.com.br
Fone: +55 (11) 3038-6554
Fax: +55 (11) 3038-6508
http://www.primesys.com.br <http://www.primesys.com.br/> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20040915/f7226f0b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LogoPrimesys.gif
Type: image/gif
Size: 2173 bytes
Desc: LogoPrimesys.gif
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20040915/f7226f0b/attachment.gif>

More information about the Devel mailing list