--- sysdeps/freebsd/procmap.c.orig Mon Oct 20 11:19:50 2003 +++ sysdeps/freebsd/procmap.c Fri Nov 14 14:44:40 2003 @@ -32,7 +32,11 @@ #include #include #include +#if (__FreeBSD_version >= 400011) +#include +#else #include +#endif #include #include @@ -90,8 +94,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; @@ -107,13 +112,19 @@ /* Get the process data */ pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); - if ((pinfo == NULL) || (count < 1)) - glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); + if ((pinfo == NULL) || (count < 1)) { + glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid); + return NULL; + } /* 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)"); @@ -131,7 +142,7 @@ buf->total = buf->number * buf->size; - maps = g_malloc (server, buf->total); + maps = g_malloc (buf->total); memset (maps, 0, buf->total); @@ -243,6 +254,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; @@ -251,13 +271,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);