]> git.proxmox.com Git - mirror_zfs.git/commit
glibc 2.5 compat: use correct header for makedev() et al.
authorOlaf Faaland <faaland1@llnl.gov>
Fri, 31 Mar 2017 16:32:00 +0000 (09:32 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 31 Mar 2017 16:32:00 +0000 (09:32 -0700)
commit10cb2e0a19e46ecfe1378ccf79e71d986936f17e
treec09c39fe0d8d827466d11fe82d576ba6dae60b4d
parent8be64caabc662aaf332fd16c7b81d0dfe58fde69
glibc 2.5 compat: use correct header for makedev() et al.

In glibc 2.5, makedev(), major(), and minor() are defined in
sys/sysmacros.h.  They are also defined in types.h for backward
compatability, but using these definitions triggers a compile warning.
This breaks the ZFS build, as it builds with -Werror.

autoconf email threads indicate these macros may be defined in
sys/mkdev.h in some cases.

This commit adds configure checks to detect where makedev() is defined:
  sys/sysmacros.h
  sys/mkdev.h

It assumes major() and minor() are defined in the same place.

The libspl types.h then includes
sys/sysmacros.h (preferred) or
sys/mkdev.h (2nd choice)
if one of those defines makedev().

This is done before including the system types.h.

An alternative would be to remove uses of major, minor, and makedev,
instead comparing the st_dev returned from stat64.  These configure
checks would then be unnecessary.

This change revealed that __NORETURN was being defined unnecessarily in
libspl/include/sys/sysmacros.h.  That definition is removed.

The files in which __NORETURN are used all include types.h, and so all
will get the definition provided by feature_tests.h

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #5945
config/user-makedev.m4 [new file with mode: 0644]
config/user.m4
lib/libspl/include/sys/sysmacros.h
lib/libspl/include/sys/types.h