1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00

Backport the kernel memory dereference patch from libgtop2.

This commit is contained in:
Joe Marcus Clarke 2002-11-01 23:52:14 +00:00
parent 4dce3e4701
commit c8f47f1b97
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=69279
2 changed files with 15 additions and 15 deletions

View File

@ -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

View File

@ -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 <sys/proc.h>
#include <sys/resource.h>
@ -12,15 +12,18 @@
#include <vm/vm_map.h>
#include <sys/vnode.h>
@@ -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