2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 05:48:07 +00:00

isadump: Fix compilation under musl

From Brendan Heading:

You may be aware of the musl C-library implementation, which tries to
be strictly standards compliant, avoids non-standard extensions, etc.
Some distributions have adopted it as their standard C library, in
others (such as buildroot) it is a configuration alternative.

Vanilla lm-sensors does not compile under musl, due to the following
excerpt which appears in four different places. The code is checking
that the glibc version is greater than 2.0.

#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
#include <sys/io.h>
#else
#include <asm/io.h>
#endif

This fails under musl does not define __GLIBC__ (in fact, by design,
it doesn't provide any way to identify itself at all) - which causes
it to try to include <asm/io.h> rather than <sys/io.h>.

It's a long time since glibc 2.0.1 was released - 1997. Accordingly,
it seems to make little sense at this stage to try to retain
compatibility with very old libcs - so maybe it should be removed
entirely.
This commit is contained in:
Jean Delvare 2015-08-31 07:34:51 +00:00
parent 6507372685
commit 8fb3922219
4 changed files with 4 additions and 30 deletions

View File

@ -29,6 +29,7 @@
isadump -f 0xecf0 0x10 1 PC87366, temperature channel 2 isadump -f 0xecf0 0x10 1 PC87366, temperature channel 2
*/ */
#include <sys/io.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -36,14 +37,6 @@
#include "util.h" #include "util.h"
#include "superio.h" #include "superio.h"
/* To keep glibc2 happy */
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
#include <sys/io.h>
#else
#include <asm/io.h>
#endif
#ifdef __powerpc__ #ifdef __powerpc__
unsigned long isa_io_base = 0; /* XXX for now */ unsigned long isa_io_base = 0; /* XXX for now */
#endif /* __powerpc__ */ #endif /* __powerpc__ */

View File

@ -26,20 +26,13 @@
isaset -f 0x5010 0x12 Write 0x12 to location 0x5010 isaset -f 0x5010 0x12 Write 0x12 to location 0x5010
*/ */
#include <sys/io.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include "util.h" #include "util.h"
/* To keep glibc2 happy */
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
#include <sys/io.h>
#else
#include <asm/io.h>
#endif
#ifdef __powerpc__ #ifdef __powerpc__
unsigned long isa_io_base = 0; /* XXX for now */ unsigned long isa_io_base = 0; /* XXX for now */
#endif /* __powerpc__ */ #endif /* __powerpc__ */

View File

@ -19,14 +19,8 @@
MA 02110-1301 USA. MA 02110-1301 USA.
*/ */
#include <stdlib.h>
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
#include <sys/io.h> #include <sys/io.h>
#else #include <stdlib.h>
#include <asm/io.h>
#endif
#include "superio.h" #include "superio.h"
int superio_parse_key(unsigned char *key, const char *s) int superio_parse_key(unsigned char *key, const char *s)

View File

@ -8,16 +8,10 @@
(at your option) any later version. (at your option) any later version.
*/ */
#include <sys/io.h>
#include <stdio.h> #include <stdio.h>
#include "util.h" #include "util.h"
/* To keep glibc2 happy */
#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
#include <sys/io.h>
#else
#include <asm/io.h>
#endif
/* Return 1 if we should continue, 0 if we should abort */ /* Return 1 if we should continue, 0 if we should abort */
int user_ack(int def) int user_ack(int def)
{ {