$NetBSD: patch-af,v 1.1.1.1 2009/01/21 14:15:15 jmcneill Exp $

--- libhb/ports.c.orig	2008-10-09 20:41:15.000000000 -0400
+++ libhb/ports.c	2009-01-21 08:57:58.000000000 -0500
@@ -16,6 +16,11 @@
 #include <sys/processor.h>
 #endif
 
+#if defined( SYS_NETBSD )
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
 #if USE_PTHREAD
 #include <pthread.h>
 #endif
@@ -76,7 +81,7 @@ void hb_snooze( int delay )
     }
 #if defined( SYS_BEOS )
     snooze( 1000 * delay );
-#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD) || defined( SYS_SunOS )
+#elif defined( SYS_DARWIN ) || defined( SYS_LINUX ) || defined( SYS_FREEBSD) || defined( SYS_SunOS ) || defined( SYS_NETBSD )
     usleep( 1000 * delay );
 #elif defined( SYS_CYGWIN )
     Sleep( delay );
@@ -124,6 +129,12 @@ int hb_get_cpu_count()
         fclose( info );
     }
 
+#elif defined( SYS_NETBSD )
+    size_t oldlen = sizeof( cpu_count );
+
+    if ( sysctlbyname( "hw.ncpu", &cpu_count, &oldlen, NULL, 0 ) != 0 )
+	cpu_count = 1;
+
 #elif defined( SYS_LINUX )
     {
         FILE * info;
