$NetBSD$

--- sysdeps/bsd/proclist.c.orig	2007-05-19 20:59:37.000000000 +0200
+++ sysdeps/bsd/proclist.c
@@ -56,11 +56,15 @@ _glibtop_init_proclist_p (glibtop *serve
 	server->sysdeps.proclist = _glibtop_sysdeps_proclist;
 }
 
-unsigned *
+pid_t *
 glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
 			gint64 real_which, gint64 arg)
 {
+#if defined(__NetBSD__)
+	struct kinfo_proc2 *pinfo;
+#else
 	struct kinfo_proc *pinfo;
+#endif
 	unsigned *pids = NULL;
 	int which, count;
 	int i,j;
@@ -72,7 +76,12 @@ glibtop_get_proclist_p (glibtop *server,
 	which = (int)(real_which & GLIBTOP_KERN_PROC_MASK);
 
 	/* Get the process data */
+#if defined(__NetBSD__)
+	pinfo = kvm_getproc2 (server->machine.kd, which, arg,
+			      sizeof (*pinfo), &count);
+#else
 	pinfo = kvm_getprocs (server->machine.kd, which, arg, &count);
+#endif
 	if ((pinfo == NULL) || (count < 1)) {
 		glibtop_warn_io_r (server, "kvm_getprocs (proclist)");
 		return NULL;
@@ -89,6 +98,12 @@ glibtop_get_proclist_p (glibtop *server,
 #define PROC_RUID	ki_ruid
 #define PROC_PID	ki_pid
 
+#elif defined(__NetBSD__)
+
+#define PROC_STAT	p_stat
+#define PROC_RUID	p_ruid
+#define PROC_PID	p_pid
+
 #else
 #define PROC_STAT	kp_proc.p_stat
 #define PROC_RUID	kp_eproc.e_pcred.p_ruid
