summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/superiotool/superiotool.c5
-rw-r--r--util/superiotool/superiotool.h5
2 files changed, 8 insertions, 2 deletions
diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c
index ed18c13e62..576e9e6702 100644
--- a/util/superiotool/superiotool.c
+++ b/util/superiotool/superiotool.c
@@ -323,9 +323,12 @@ int main(int argc, char *argv[])
#if defined(__FreeBSD__)
if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
perror("/dev/io");
-#else
+#elif defined(__NetBSD__)
if (iopl(3) < 0) {
perror("iopl");
+#else
+ if (ioperm(0, 6000, 1) < 0) {
+ perror("ioperm");
#endif
printf("Superiotool must be run as root.\n");
exit(1);
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h
index a621ae5274..8c01559759 100644
--- a/util/superiotool/superiotool.h
+++ b/util/superiotool/superiotool.h
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <string.h>
#include <getopt.h>
-#if defined(__GLIBC__)
+#if defined(__linux__)
#include <sys/io.h>
#endif
#if (defined(__MACH__) && defined(__APPLE__))
@@ -24,6 +24,9 @@
# endif
#endif
+#include <sys/types.h>
+#include <stdint.h>
+
#if defined(__FreeBSD__)
#include <sys/types.h>
#include <machine/cpufunc.h>