Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin multimeter: fix compilation error in AIX. #549

Closed
wants to merge 1 commit into from
Closed

Plugin multimeter: fix compilation error in AIX. #549

wants to merge 1 commit into from

Conversation

manuelluis
Copy link
Contributor

The plugin multimeter is build by default, in AIX when you compile in 64 bit you get the error:

Target "all-am" is up to date.
  CC     multimeter.lo
multimeter.c: In function 'multimeter_init':
multimeter.c:173:4: error: overflow in implicit constant conversion [-Werror=overflow]
cc1: all warnings being treated as errors
make: 1254-004 The error code from the last command is 1.

The TIOCMBIC is defined:

sys/ioctl.h:#define   TIOCMBIC        _IOW('t', 107, int)     /* bic modem bits */

and the other defines:

sys/stropts.h:#define _IOW(x,y,t)     (_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
sys/stropts.h:#define _IOC_IN          0x80000000      /* copy in parameters */
sys/stropts.h:#define _IOCPARM_MASK    0x7f

in /usr/include/sys/ioctl.h more than a half have a cast to int, for example:

#define SIOCADDMTU      (int)_IOW('i',112, int) /* add mtu  */
#define SIOCDELMTU      (int)_IOW('i',113, int) /* delete mtu */
#define SIOCIF_ATM_UBR          (int)_IOW('i',120,struct ifreq)  /* set ubr rate */
#define SIOCIF_ATM_SNMPARP      (int)_IOW('i',121,struct ifreq)  /* atm snmp arp */
#define SIOCIF_ATM_IDLE         (int)_IOW('i',122,struct ifreq)  /* set idle time */
#define   TIOCMBIC        _IOW('t', 107, int)     /* bic modem bits */

If you compile in AIX collectd in 32 bits you will not get the error.

Other option is to disable the build of multimeter in AIX.

@mfournier
Copy link

So I trust you this makes the build pass :-) But what can be the implications of this change on the way the plugin works ? Also on other platforms than AIX ?

@manuelluis
Copy link
Contributor Author

The other option is disable this plugin in AIX.
Is very rare that someone use this plugin with AIX.

@@ -170,7 +170,7 @@ static int multimeter_init (void)

tcflush(fd, TCIFLUSH);
tcsetattr(fd, TCSANOW, &tios);
ioctl(fd, TIOCMBIC, &rts);
ioctl(fd, (int)TIOCMBIC, &rts);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this arg is a u_long on other platform (e.g: linux) maybe it's worth doing an #ifdef

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it's easy to disable this plugin for AIX. Nobody is going to plug this:http://www.reinhardweiss.de/pictures/metex/m4650cr.gif to an AIX server.

Do I make a pull request to disable it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great!
On Jul 28, 2014 11:26 PM, "manuelluis" notifications@github.com wrote:

In src/multimeter.c:

@@ -170,7 +170,7 @@ static int multimeter_init (void)

        tcflush(fd, TCIFLUSH);
        tcsetattr(fd, TCSANOW, &tios);
  •       ioctl(fd, TIOCMBIC, &rts);
    
  •       ioctl(fd, (int)TIOCMBIC, &rts);
    

I think that it's easy to disable this plugin for AIX. Nobody is going to
plug this:http://www.reinhardweiss.de/pictures/metex/m4650cr.gif to an
AIX server.

Do I make a pull request to disable it?


Reply to this email directly or view it on GitHub
https://github.com/collectd/collectd/pull/549/files#r15492101.

@mfournier mfournier removed the Patch label Jul 29, 2014
@manuelluis
Copy link
Contributor Author

Disable in #684

@manuelluis manuelluis closed this Jul 29, 2014
@manuelluis manuelluis deleted the mlsr/multimeter-aix branch December 14, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants