[collectd] More AIX stuff

Florian Forster octo at verplant.org
Tue Mar 9 16:54:55 CET 2010

Hi Andrés,

thanks for you patches :)

On Tue, Feb 16, 2010 at 12:08:44PM +0100, Andrés J. Díaz wrote:
> Here are some minor patches to AIX port of collectd. The first one
> (aix-test-htonll) adds support to check if the htonl and htonll
> functions (which are used in AIX port) are available in configure.

I've applied the patch that uses "AC_RUN_IFELSE" to collectd-4.8. I hope
it doesn't break cross-compiling ;)

> The second one port memcached plugin to AIX. Since AIX don't have
> MSG_DONTWAIT flag support, we use MSG_NONBLOCK... and we hope to work
> fine ever :)

It's in collectd-4.8, too. Looks like a typical "... but we like our old
and non-standard define names!" ;)

> Finally port the multimeter plugin too, which do not compile in AIX
> without an explicit cast for TIOCMBIC (don't ask). May forcing a cast
> is not very elegant for other os... What do you think, Florian? Maybe
> we could use here a per-os #ifdef?

Unfortunately the "request" argument for ioctl(2) is not properly
standardized. It's a "unsigned long" in the GNU libc (even though my
manpage says "int" it is in fact an "unsigned long"), Mac OS X, *BSD and
BeOS. It's an "int" in AIX, HP-UX, IRIX, OSF/1, Solaris, Cygwin,
Interix. [0]

Since "int"s are usually 32 bit wide and "long"s are the new "int"s, I
assume that signedness warnings will pop up on 32 bit systems with a
cast to "int".

If possible, I'd like to get away without a system specific define, but
currently I don't see how that should be done.

The parser code generated by yacc uses the "_AIX" define to detect if
it's been compiled under AIX. Could you please check if the following
works for you?:

  #ifdef _AIX
  # define IOCTL_REQ_CAST (int)
  # define IOCTL_REQ_CAST /**/
  ioctl(fd, IOCTL_REQ_CAST TIOCMBIC, &rts);

> The work was done by my colleage Manuel (as previously do), so
> credits for him, please.

I've committed the changes with the following author information:

  Manuel Sanmartin (no email) <collectd at verplant.org>

Please say thank you to Manuel from me :)

> We promise to try port other plugins to AIX in next months :)

Yay :)

Thanks again for your patches :)


[0] I fully trust that guy to have figured that out correctly. It
    matches with my findings for GNU libc, *BSD, Mac OS X and Solaris.
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20100309/a42521ab/attachment.pgp 

More information about the collectd mailing list