Skip to contentSkip to conversation

util-linux-2.22: backward compatibility of wdctl

DISCUSSION Moritz Barsnick 3 participants 4 messages Sep 5, 2012 – Sep 7, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi everyone,
congratulations on util-linux 2.22. BTW, I recently took the liberty of refreshing the freshmeat aka freecode entry, and submitted an update for 2.22 today. I hope that's okay.

Anyway, just for the fun of it, I was trying to compile util-linux on an SLES10 (SUSE Linux Enterprise) machine. That's one of those enterprise distributions with somewhat ancient environments. ;-) But nothing out of the ordinary nowadays, I think.

I didn't succeed, because wdctl makes use of #defines which are not defined on this OS:

make[2]: Entering directory `/tmp/Bui/util-linux/util-linux-2.22'
CC sys-utils/wdctl.o
sys-utils/wdctl.c:53:4: error: 'WDIOF_PRETIMEOUT' undeclared here (not in a function)
sys-utils/wdctl.c: In function 'read_watchdog':
sys-utils/wdctl.c:352:17: error: 'WDIOC_GETPRETIMEOUT' undeclared (first use in this function) sys-utils/wdctl.c:352:17: note: each undeclared identifier is reported only once for each function it appears in sys-utils/wdctl.c:352:3: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [enabled by default] In file included from sys-utils/wdctl.c:21:0:
/usr/include/sys/ioctl.h:42:12: note: expected 'long unsigned int' but argument is of type 'const struct wdflag *' sys-utils/wdctl.c:354:17: error: 'WDIOC_GETTIMELEFT' undeclared (first use in this function) sys-utils/wdctl.c:354:3: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [enabled by default] In file included from sys-utils/wdctl.c:21:0:
/usr/include/sys/ioctl.h:42:12: note: expected 'long unsigned int' but argument is of type 'const struct wdflag *' make[2]: *** [sys-utils/wdctl.o] Error 1

This system's/kernel's watchdog.h doesn't have those #defines:

Quoted 1 line

grep -rFn WDIOC_ /usr/include/

/usr/include/linux/compat_ioctl.h:603:COMPATIBLE_IOCTL(WDIOC_GETSUPPORT) /usr/include/linux/compat_ioctl.h:604:COMPATIBLE_IOCTL(WDIOC_GETSTATUS) /usr/include/linux/compat_ioctl.h:605:COMPATIBLE_IOCTL(WDIOC_GETBOOTSTATUS) /usr/include/linux/compat_ioctl.h:606:COMPATIBLE_IOCTL(WDIOC_GETTEMP) /usr/include/linux/compat_ioctl.h:607:COMPATIBLE_IOCTL(WDIOC_SETOPTIONS) /usr/include/linux/compat_ioctl.h:608:COMPATIBLE_IOCTL(WDIOC_KEEPALIVE) /usr/include/linux/compat_ioctl.h:609:COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT) /usr/include/linux/compat_ioctl.h:610:COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT)

  /usr/include/linux/watchdog.h:23:#define        WDIOC_GETSUPPORT        _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info)
  /usr/include/linux/watchdog.h:24:#define        WDIOC_GETSTATUS         _IOR(WATCHDOG_IOCTL_BASE, 1, int)
  /usr/include/linux/watchdog.h:25:#define        WDIOC_GETBOOTSTATUS     _IOR(WATCHDOG_IOCTL_BASE, 2, int)
  /usr/include/linux/watchdog.h:26:#define        WDIOC_GETTEMP           _IOR(WATCHDOG_IOCTL_BASE, 3, int)
  /usr/include/linux/watchdog.h:27:#define        WDIOC_SETOPTIONS        _IOR(WATCHDOG_IOCTL_BASE, 4, int)
  /usr/include/linux/watchdog.h:28:#define        WDIOC_KEEPALIVE         _IOR(WATCHDOG_IOCTL_BASE, 5, int)
  /usr/include/linux/watchdog.h:29:#define        WDIOC_SETTIMEOUT        _IOWR(WATCHDOG_IOCTL_BASE, 6, int)
  /usr/include/linux/watchdog.h:30:#define        WDIOC_GETTIMEOUT        _IOR(WATCHDOG_IOCTL_BASE, 7, int)

To add to the misery, it isn't possible to disable the build of wdctl AFAICT.

System info:

Quoted 1 line

cat /etc/SuSE-release

SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 3

Quoted 1 line

uname -r

2.6.16.60-0.58.1.3835.0.PTF.638363-smp

Thanks,
Moritz

#1 lore raw
Quoted 28 lines · Moritz Barsnick

Hi everyone,
congratulations on util-linux 2.22. BTW, I recently took the liberty of refreshing the freshmeat aka freecode entry, and submitted an update for 2.22 today. I hope that's okay.

Anyway, just for the fun of it, I was trying to compile util-linux on an SLES10 (SUSE Linux Enterprise) machine. That's one of those enterprise distributions with somewhat ancient environments. ;-) But nothing out of the ordinary nowadays, I think.

I didn't succeed, because wdctl makes use of #defines which are not defined on this OS:

make[2]: Entering directory `/tmp/Bui/util-linux/util-linux-2.22'
CC sys-utils/wdctl.o
sys-utils/wdctl.c:53:4: error: 'WDIOF_PRETIMEOUT' undeclared here (not in a function)
sys-utils/wdctl.c: In function 'read_watchdog':
sys-utils/wdctl.c:352:17: error: 'WDIOC_GETPRETIMEOUT' undeclared (first use in this function) sys-utils/wdctl.c:352:17: note: each undeclared identifier is reported only once for each function it appears in sys-utils/wdctl.c:352:3: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [enabled by default] In file included from sys-utils/wdctl.c:21:0:
/usr/include/sys/ioctl.h:42:12: note: expected 'long unsigned int' but argument is of type 'const struct wdflag *' sys-utils/wdctl.c:354:17: error: 'WDIOC_GETTIMELEFT' undeclared (first use in this function) sys-utils/wdctl.c:354:3: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [enabled by default] In file included from sys-utils/wdctl.c:21:0:
/usr/include/sys/ioctl.h:42:12: note: expected 'long unsigned int' but argument is of type 'const struct wdflag *' make[2]: *** [sys-utils/wdctl.o] Error 1

Quoted 6 lines

This system's/kernel's watchdog.h doesn't have those #defines:

[...]

To add to the misery, it isn't possible to disable the build of wdctl AFAICT.

You can use a crude hack to work around building wdctl:

  $ touch sys-utils/wdctl.o wdctl ; make

but this won't make you happy. You'll most propably hit other problems. This is from my SLES 10.4 system:

In file included from disk-utils/partx.h:5,

                   from disk-utils/partx.c:32:

/usr/include/linux/blkpg.h:36: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token In file included from disk-utils/partx.c:32:
disk-utils/partx.h: In function ‘partx_del_partition’:
disk-utils/partx.h:32: error: ‘struct blkpg_ioctl_arg’ has no member named ‘data’ disk-utils/partx.h: In function ‘partx_add_partition’:
disk-utils/partx.h:51: error: ‘struct blkpg_ioctl_arg’ has no member named ‘data’ disk-utils/partx.h: In function ‘partx_resize_partition’:
disk-utils/partx.h:70: error: ‘struct blkpg_ioctl_arg’ has no member named ‘data’ make[2]: *** [disk-utils/partx-partx.o] Error 1

Temporarily defining __user to nothing seems to work:

  $ make CFLAGS='-D__user='

... although this is another bad workaround. ;-(

Have a nice day,
Berny

#2 lore raw

Hi Bernhard,
[thanks for CC'ing me, as I'm not subscribed]

Quoted 2 lines · Bernhard Voelker

You can use a crude hack to work around building wdctl:

  $ touch sys-utils/wdctl.o wdctl ; make

Fine for me for the time being. I just wanted to point this out because it will break people's (and distributions') builds.

Quoted 2 lines

but this won't make you happy. You'll most propably hit other problems. This is from my SLES 10.4 system:

I see the same thing as you in partx, of course.

Quoted 2 lines

Temporarily defining __user to nothing seems to work:

  $ make CFLAGS='-D__user='

Good point. I figured out that this is supposed to be happening in <linux/compiler.h>, but even including that didn't help. At least partx build can be disabled (--disable-partx).

Quoted 1 line

... although this is another bad workaround. ;-(

Looking forward to 2.22.1. :-)

Thanks,
Moritz

maintainer
#3 lore raw
In reply to Moritz Barsnick
Quoted 3 lines · Moritz Barsnick

congratulations on util-linux 2.22. BTW, I recently took the liberty of refreshing the freshmeat aka freecode entry, and submitted an update for 2.22 today. I hope that's okay.

..arbitrary advertising is okay.

Quoted 2 lines

Anyway, just for the fun of it, I was trying to compile util-linux on an SLES10 (SUSE Linux Enterprise) machine. That's one of those

Do you know that we had -rc1 and -rc2 release? :-)

Quoted 2 lines

enterprise distributions with somewhat ancient environments. ;-) But nothing out of the ordinary nowadays, I think.

Well, it seems that you have kernel header < 2.6.18 (the macros has been added in Apr and May 2006).

Quoted 5 lines

CC sys-utils/wdctl.o
sys-utils/wdctl.c:53:4: error: 'WDIOF_PRETIMEOUT' undeclared here (not in a function) sys-utils/wdctl.c: In function 'read_watchdog':
sys-utils/wdctl.c:352:17: error: 'WDIOC_GETPRETIMEOUT' undeclared (first use in this function) sys-utils/wdctl.c:352:17: note: each undeclared identifier is reported only once for each function it appears in

Quoted 8 lines

sys-utils/wdctl.c:352:3: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [enabled by default] In file included from sys-utils/wdctl.c:21:0:
/usr/include/sys/ioctl.h:42:12: note: expected 'long unsigned int' but argument is of type 'const struct wdflag *' sys-utils/wdctl.c:354:17: error: 'WDIOC_GETTIMELEFT' undeclared (first use in this function) sys-utils/wdctl.c:354:3: warning: passing argument 2 of 'ioctl' makes integer from pointer without a cast [enabled by default] In file included from sys-utils/wdctl.c:21:0:
/usr/include/sys/ioctl.h:42:12: note: expected 'long unsigned int' but argument is of type 'const struct wdflag *' make[2]: *** [sys-utils/wdctl.o] Error 1

Fixed.

Quoted 1 line

This system's/kernel's watchdog.h doesn't have those #defines:

Sure, it's always bad/expensive idea to mix old OS and new system packages.

Quoted 2 lines

To add to the misery, it isn't possible to disable the build of wdctl AFAICT.

Fixed, I have added --disable-wdctl.

Quoted 1 line

2.6.16.60-0.58.1.3835.0.PTF.638363-smp

yep...

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com