Add support for FreeBSD 6-CURRENT. Use the more portable getrlimit to
* Makefile.am: * netlist.c: (glibtop_get_netlist_s): * procmap.c: (glibtop_get_proc_map_p): * procmem.c: (glibtop_get_proc_mem_p): * procopenfiles.c: (glibtop_init_proc_open_files_s), (glibtop_get_proc_open_files_s): * proctime.c: Add support for FreeBSD 6-CURRENT. Use the more portable getrlimit to obtain process memory limits. Correctly determine process time. Stub out the procopenfiles() function (this is not yet implemented, however). Fix a nasty infinite loop and memory leak due to a forgot pointer increment. Patch from marcus@freebsd.org (Joe Marcus Clarke). Closes #168232.
This commit is contained in:
@@ -47,7 +47,13 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define _KVM_VNODE
|
||||
#endif
|
||||
#include <sys/vnode.h>
|
||||
#ifdef __FreeBSD__
|
||||
#undef _KVM_VNODE
|
||||
#endif
|
||||
#include <sys/mount.h>
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
@@ -104,7 +110,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
|
||||
glibtop_map_entry *maps;
|
||||
#if defined __FreeBSD__
|
||||
struct vnode vnode;
|
||||
#if __FreeBSD_version >= 500039
|
||||
#if __FreeBSD_version < 500039
|
||||
struct inode inode;
|
||||
#endif
|
||||
#endif
|
||||
@@ -122,8 +128,10 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
|
||||
|
||||
/* Get the process data */
|
||||
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count < 1))
|
||||
if ((pinfo == NULL) || (count < 1)) {
|
||||
glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Now we get the memory maps. */
|
||||
|
||||
@@ -264,8 +272,10 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
|
||||
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500039)
|
||||
switch (vnode.v_type) {
|
||||
case VREG:
|
||||
#if __FreeBSD_version < 600006
|
||||
maps [i-1].inode = vnode.v_cachedid;
|
||||
maps [i-1].device = vnode.v_cachedfs;
|
||||
#endif
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
@@ -278,13 +288,9 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
|
||||
&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)");
|
||||
#endif
|
||||
maps [i-1].inode = inode.i_number;
|
||||
maps [i-1].device = inode.i_dev;
|
||||
#endif
|
||||
#endif
|
||||
} while (entry.next != first);
|
||||
|
||||
|
Reference in New Issue
Block a user