1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-31 10:46:16 +00:00
freebsd-ports/devel/libgtop2/files/patch-ah
2002-11-01 23:43:38 +00:00

69 lines
1.8 KiB
Plaintext

--- sysdeps/freebsd/procmap.c.orig Mon Jun 10 17:34:42 2002
+++ sysdeps/freebsd/procmap.c Sat Oct 26 01:20:26 2002
@@ -33,7 +33,11 @@
#include <sys/proc.h>
#include <sys/resource.h>
#include <vm/vm_object.h>
+#if (__FreeBSD_version >= 400011)
+#include <vm/vm.h>
+#else
#include <vm/vm_prot.h>
+#endif
#include <vm/vm_map.h>
#include <sys/vnode.h>
@@ -91,8 +95,9 @@
glibtop_map_entry *maps;
#if defined __FreeBSD__
struct vnode vnode;
+#if __FreeBSD_version < 500039
struct inode inode;
- struct mount mount;
+#endif
#endif
int count, i = 0;
int update = 0;
@@ -114,7 +119,11 @@
/* Now we get the memory maps. */
if (kvm_read (server->machine.kd,
+#if (__FreeBSD_version >= 500013)
+ (unsigned long) pinfo [0].ki_vmspace,
+#else
(unsigned long) pinfo [0].kp_proc.p_vmspace,
+#endif
(char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace))
glibtop_error_io_r (server, "kvm_read (vmspace)");
@@ -244,6 +253,15 @@
&vnode, sizeof (vnode)) != sizeof (vnode))
glibtop_error_io_r (server, "kvm_read (vnode)");
+#if __FreeBSD_version >= 500039
+ 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) ||
!vnode.v_data) continue;
@@ -252,13 +270,9 @@
&inode, sizeof (inode)) != sizeof (inode))
glibtop_error_io_r (server, "kvm_read (inode)");
- if (kvm_read (server->machine.kd,
- (unsigned long) vnode.v_mount,
- &mount, sizeof (mount)) != sizeof (mount))
- glibtop_error_io_r (server, "kvm_read (mount)");
-
maps [i-1].inode = inode.i_number;
maps [i-1].device = inode.i_dev;
+#endif
#endif
} while (entry.next != first);