freeipmi: fix build on non-x86 musl

This commit is contained in:
q66 2019-12-18 04:36:29 +01:00
parent e2d60eec9a
commit 8f0972e9b7

View file

@ -0,0 +1,23 @@
Musl, unlike glibc, provides inb/outb but only on x86.
Additionally, the iopl call is generally useless outside x86.
--- libfreeipmi/driver/ipmi-kcs-driver.c
+++ libfreeipmi/driver/ipmi-kcs-driver.c
@@ -162,7 +162,7 @@
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# define _INB(port) inb (port)
# define _OUTB(data, port) outb (port, data)
-#elif defined(HAVE_IOPL)
+#elif defined(HAVE_IOPL) && (defined(__x86_64__) || defined(__i386__))
# define _INB(port) inb (port)
# define _OUTB(data, port) outb (data, port)
#else
@@ -509,7 +508,7 @@ ipmi_kcs_ctx_io_init (ipmi_kcs_ctx_t ctx)
}
#endif /* !USE_IOPERM */
#else /* !__FreeBSD__ */
-#if HAVE_IOPL
+#if defined(HAVE_IOPL) && (defined(__x86_64__) || defined(__i386__))
if (iopl (3) < 0)
{
KCS_ERRNO_TO_KCS_ERRNUM (ctx, errno);