2013-09-26 17:14:40 +02:00

39 lines
1.1 KiB
Plaintext

$NetBSD: patch-af,v 1.2 2009/04/28 11:57:55 hasso 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 ) || defined( SYS_DRAGONFLY )
+#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 ) || defined( SYS_DRAGONFLY )
usleep( 1000 * delay );
#elif defined( SYS_CYGWIN )
Sleep( delay );
@@ -124,6 +129,12 @@ int hb_get_cpu_count()
fclose( info );
}
+#elif defined( SYS_NETBSD ) || defined( SYS_DRAGONFLY )
+ 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;