$OpenBSD: patch-src_misc_parallel_c,v 1.1 2018/07/24 13:09:47 fcambus Exp $

Index: src/misc/parallel.c
--- src/misc/parallel.c.orig
+++ src/misc/parallel.c
@@ -698,7 +698,7 @@ parport_open (unsigned short port)
     }                                           //  causes core dump
 #endif // __linux__ && (__i386__ || __x86_64__) && !USE_PPDEV
 
-#ifdef  __OpenBSD__ // || defined __NetBSD__, add after feature request ;-)
+#if     (defined __OpenBSD__ || defined __NetBSD__) && defined __i386__
   // We use i386_iopl() on OpenBSD for the same reasons we use iopl() on Linux
   //  (i386_set_ioperm() has the same limitation as ioperm()).
   if (i386_iopl (3) == -1)
@@ -708,6 +708,17 @@ parport_open (unsigned short port)
              stderr);
       exit (1);
     }
+#endif
+#ifdef  __x86_64__
+#ifdef  __OpenBSD__
+  if (amd64_iopl (3) == -1)
+    {
+      fputs ("ERROR: Could not set the I/O privilege level to 3\n"
+             "       (This program needs root privileges for the requested action)\n",
+             stderr);
+      exit (1);
+    }
+#endif
 #endif
 
 #if     (defined __i386__ || defined __x86_64__ || defined _WIN32) && !defined USE_PPDEV
