pkgsrc/sysutils/libgtop/patches/patch-an
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

43 lines
1.2 KiB
Text

$NetBSD: patch-an,v 1.4 2007/11/05 19:06:05 drochner Exp $
--- sysdeps/bsd/procstate.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procstate.c
@@ -54,7 +54,11 @@ glibtop_get_proc_state_p (glibtop *serve
glibtop_proc_state *buf,
pid_t pid)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
int count = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
@@ -65,7 +69,12 @@ glibtop_get_proc_state_p (glibtop *serve
if (pid == 0) return;
/* Get the process information */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count != 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -79,6 +88,13 @@ glibtop_get_proc_state_p (glibtop *serve
#define PROC_RGID ki_rgid
#define PROC_STAT ki_stat
+#elif defined(__NetBSD__)
+
+#define PROC_COMM p_comm
+#define PROC_SVUID p_svuid
+#define PROC_SVGID p_svgid
+#define PROC_STAT p_stat
+
#else
#define PROC_COMM kp_proc.p_comm
#define PROC_SVUID kp_eproc.e_pcred.p_svuid