pkgsrc/sysutils/libgtop/patches/patch-aj
drochner 4d7f1acf90 update to 2.20.0
This switches to the new gnome-2.20 branch.

pkgsrc notes:
-System dependant parts were reorganized upstream, in particular there
 if a subtree for FreeBSD now, and one for the other BSDs. I didn't
 pull in the DragonFly patches because I can't decide whether to base
 them on the freebsd or the rest.
-I've changed the NetBSD code to use kinfo_proc2 almost completely.
 Some vm statistics reporting might be less accurate now because
 some fields in proc2 seem to be unmaintained by the current kernel
 (eg ixrss).
-Also, some libgtop functions might be able to run in the non-privileged
 part now, but dealing with this would require even more #ifdefs, so
 we should consider setting up a private subtree as FreeBSD did.
-I didn't verify with older NetBSDs; kvm_getproc2() has been in the
 tree for quite some time so I hope it will just work without the need
 for excessive "#if __NetBSD_Version__ > t".
2007-11-05 19:06:02 +00:00

47 lines
1.3 KiB
Text

$NetBSD: patch-aj,v 1.4 2007/11/05 19:06:04 drochner Exp $
--- 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