From c8f47f1b97ad361f2e6b387e30d914ec9642e096 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Fri, 1 Nov 2002 23:52:14 +0000 Subject: [PATCH] Backport the kernel memory dereference patch from libgtop2. --- devel/libgtop/Makefile | 2 +- devel/libgtop/files/patch-ah | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/devel/libgtop/Makefile b/devel/libgtop/Makefile index 92e36a0d8ab2..2626a4eb9bea 100644 --- a/devel/libgtop/Makefile +++ b/devel/libgtop/Makefile @@ -7,7 +7,7 @@ PORTNAME= libgtop PORTVERSION= 1.0.13 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= devel gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/libgtop/1.0 diff --git a/devel/libgtop/files/patch-ah b/devel/libgtop/files/patch-ah index 8b51deb9adda..db7894c05f9e 100644 --- a/devel/libgtop/files/patch-ah +++ b/devel/libgtop/files/patch-ah @@ -1,5 +1,5 @@ --- sysdeps/freebsd/procmap.c.orig Mon Nov 26 17:37:59 2001 -+++ sysdeps/freebsd/procmap.c Sat Oct 19 14:07:46 2002 ++++ sysdeps/freebsd/procmap.c Fri Nov 1 18:48:52 2002 @@ -33,7 +33,11 @@ #include #include @@ -12,15 +12,18 @@ #include #include -@@ -92,7 +96,6 @@ +@@ -91,8 +95,9 @@ + glibtop_map_entry *maps; #if defined __FreeBSD__ struct vnode vnode; ++#if __FreeBSD_version < 50039 struct inode inode; - struct mount mount; ++#endif #endif int count, i = 0; int update = 0; -@@ -114,7 +117,11 @@ +@@ -114,7 +119,11 @@ /* Now we get the memory maps. */ if (kvm_read (server->machine.kd, @@ -32,21 +35,18 @@ (char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) glibtop_error_io_r (server, "kvm_read (vmspace)"); -@@ -217,7 +224,7 @@ - if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID) - continue; - -- if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) || -+ if ((vnode.v_type != VREG) || strcmp("ufs", vnode.v_tag) || - !vnode.v_data) continue; - - if (kvm_read (server->machine.kd, -@@ -244,18 +251,17 @@ +@@ -244,18 +253,23 @@ &vnode, sizeof (vnode)) != sizeof (vnode)) glibtop_error_io_r (server, "kvm_read (vnode)"); +#if __FreeBSD_version >= 500039 -+ if ((vnode.v_type != VREG) || strcmp("ufs", vnode.v_tag) || ++ switch (vnode.v_type) { ++ case VREG: ++ maps [i-1].inode = vnode.v_cachedid; ++ maps [i-1].device = vnode.v_cachedfs; ++ default: ++ continue; ++ } +#else if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) || +#endif