$NetBSD: patch-ac,v 1.2 2005/12/28 14:17:57 joerg Exp $

--- src/graph/graphunixx11.c.orig	2004-07-16 01:59:53.000000000 +0000
+++ src/graph/graphunixx11.c
@@ -3085,11 +3085,30 @@ void ewait(INTBIG process)
 /*
  * Routine to return the number of processors on this machine.
  */
+
+/* XXX there should really be some sort of autoconf test here... */
+#if defined(__NetBSD__) || defined(__DragonFly__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
 INTBIG enumprocessors(void)
 {
 	INTBIG numproc;
 
+#if defined(__NetBSD__) || defined(__DragonFly__)
+	int mib[2], ncpu;
+	size_t len;
+
+	mib[0] = CTL_HW;
+	mib[1] = HW_NCPU;
+	len = sizeof(ncpu);
+	sysctl(mib, 2, &ncpu, &len, NULL, 0);
+	numproc = (INTBIG) ncpu;
+
+#else
 	numproc = sysconf(_SC_NPROCESSORS_ONLN);
+#endif
 	return(numproc);
 }
 
