$NetBSD: patch-ai,v 1.2 2007/04/27 19:45:01 christos Exp $

--- ioctl.c.orig	2005-02-02 15:32:13.000000000 -0500
+++ ioctl.c	2007-04-27 11:35:05.000000000 -0400
@@ -68,6 +68,7 @@
 const struct ioctlent *ioctlent;
 int nioctlents;
 
+#ifndef NETBSD
 static int
 compare(a, b)
 const void *a;
@@ -77,11 +78,19 @@
 	unsigned long code2 = ((struct ioctlent *) b)->code;
 	return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
 }
+#endif
 
 const struct ioctlent *
 ioctl_lookup(code)
 long code;
 {
+#ifdef NETBSD
+	int i;
+	for (i = 0; i < nioctlents; i++)
+		if (ioctlent[i].code == code)
+			return  &ioctlent[i];
+	return NULL;
+#else
 	struct ioctlent *iop, ioent;
 
 	ioent.code = code;
@@ -96,6 +105,7 @@
 			break;
 		}
 	return iop;
+#endif
 }
 
 const struct ioctlent *
@@ -130,14 +140,14 @@
 	case 0x89:
 #else /* !LINUX */
 	case 'r': case 's': case 'i':
-#ifndef FREEBSD
+#ifndef ALLBSD
 	case 'p':
 #endif
 #endif /* !LINUX */
 		return sock_ioctl(tcp, code, arg);
 #ifdef USE_PROCFS
 #ifndef HAVE_MP_PROCFS
-#ifndef FREEBSD
+#ifndef ALLBSD
 	case 'q':
 #else
 	case 'p':