Fix a bug in netlist where glibtop_netlist.number was never initialized to
* Makefile.am: * cpu.c: (glibtop_get_cpu_p): * netlist.c: (glibtop_get_netlist_s): * netload.c: (glibtop_get_netload_p): * procmem.c: (glibtop_get_proc_mem_p): Fix a bug in netlist where glibtop_netlist.number was never initialized to 0 (this resulted in a NULL pointer dereference in the network load feature of the multiload applet) * Add support for getting interface flags and packet counts even on interfaces without IP addresses (needed for the network load feature of the multiload applet) * Restore per-process limits in the !FreeBSD or __FreeBSD_version < 500013 case * Add CPU interrupt time as IOWAIT to get support for the cpu load feature of the multiload applet. Patch from marcus@freebsd.org (Joe Marcus Clarke). Closes #168704.
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/resource.h>
|
||||
#ifdef __NetBSD__ && (__NetBSD_Version__ >= 105020000)
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105020000)
|
||||
#include <uvm/uvm_extern.h>
|
||||
#else
|
||||
#include <vm/vm_object.h>
|
||||
@@ -47,7 +47,7 @@
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
#include <sys/sysctl.h>
|
||||
#ifdef __NetBSD__ && (__NetBSD_Version__ >= 105020000)
|
||||
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105020000)
|
||||
#include <uvm/uvm.h>
|
||||
#else
|
||||
#include <vm/vm.h>
|
||||
@@ -125,7 +125,9 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
|
||||
#else
|
||||
struct vm_object object;
|
||||
#endif
|
||||
struct rlimit rlimit;
|
||||
#if !defined(__FreeBSD__) || (__FreeBSD_version < 500013)
|
||||
struct plimit plimit;
|
||||
#endif
|
||||
int count;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0);
|
||||
@@ -160,12 +162,15 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
|
||||
|
||||
#define PROC_VMSPACE kp_proc.p_vmspace
|
||||
|
||||
if (getrlimit (RLIMIT_RSS, &rlimit) < 0) {
|
||||
glibtop_warn_io_r (server, "getrlimit");
|
||||
if (kvm_read (server->machine.kd,
|
||||
(unsigned long) pinfo [0].PROC_VMSPACE,
|
||||
(char *) &plimit, sizeof (plimit)) != sizeof (plimit)) {
|
||||
glibtop_warn_io_r (server, "kvm_read (plimit)");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->rss_rlim = (u_int64_t) (rlimit.rlim_cur);
|
||||
buf->rss_rlim = (guint64)
|
||||
(plimit.pl_rlimit [RLIMIT_RSS].rlim_cur);
|
||||
|
||||
vms = &pinfo [0].kp_eproc.e_vm;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user