pkgsrc/sysutils/gkrellm/patches/patch-ad
cube b7952b251a Update GKrellM packages to version 2.2.10. Better late than never.
2.2.10 - Thu Oct 26, 2006
-------------------------
        * Hans de Goede patches: 1) handle sysfs sensors which represent themselves
          as platform drivers (/sys/class/hwmon). 2) Add a libsensors sensor
          monitor interface which will be used preferentially over sysfs if
          libsensors is installed and sensors_init() on /etc/sensors.conf succeeds.
        * Add --without-libsensors command line option to force using /sysfs
          instead of libsensors for cases when running a new Linux sensor kernel
          module that is not yet supported by libsensors.  A fallback to /sysfs is
          automatic when libsensors detects zero sensors.
        * Linux sensor config names change with migration to libsensors, so attempt
          to automatically do a conversion so user won't have to redo sensor
          config.  But this doesn't handle client/server runs so for these
          sensor configs must be redone.
        * Michael Buesch patch: Add PowerMac G5 Windfarm sensor monitor interface.
        * David G. North patch: Add content length check to mbox mail checking to
          get good mail counts even if there's a mal-formed mime content package.
        * New Translation
          o pt_BR.po from Insigne Free Software (traducao--at--insignelinux.org)
        * Translation updates
          o de.po
          o it.po from Vincenzo Reale
        * Bugfixes
          o Christian Schmidt patch: add -pci- to sensor config compatibility fix.
          o gkrellmd plugins didn't get initial update data.
          o Don't limit mbmon detection to i386 architectures.
          o Flush gtk events pending between closing and moving gkrellm so
            window managers can get width updates before the move.
          o Fix warnings from newer gcc.
2007-05-03 20:21:27 +00:00

221 lines
5.6 KiB
Text

$NetBSD: patch-ad,v 1.3 2007/05/03 20:21:27 cube Exp $
--- src/sysdeps/bsd-net-open.c.orig 2006-07-20 23:38:57.000000000 +0200
+++ src/sysdeps/bsd-net-open.c
@@ -23,110 +23,10 @@
/* ===================================================================== */
-/* Disk monitor interface */
-
-#include <sys/dkstat.h>
-#include <sys/disk.h>
-#include <kvm.h>
-
-static struct nlist nl_disk[] = {
-#define X_DISK_COUNT 0
- { "_disk_count" }, /* number of disks */
-#define X_DISKLIST 1
- { "_disklist" }, /* TAILQ of disks */
- { NULL },
-};
-
-static struct disk *dkdisks; /* kernel disk list head */
-
-extern kvm_t *kvmd;
-
-static gint n_disks;
-
-gchar *
-gkrellm_sys_disk_name_from_device(gint device_number, gint unit_number,
- gint *order)
- {
- return NULL; /* disk data by device not implemented */
- }
-
-gint
-gkrellm_sys_disk_order_from_name(gchar *name)
- {
- return -1; /* append disk charts as added */
- }
-
-
-void
-gkrellm_sys_disk_read_data(void)
-{
- struct disk d, *p;
- gint i;
- char buf[20];
- guint64 rbytes, wbytes;
-
- if (kvmd == NULL) return;
- if (n_disks <= 0) return; /* computed by register_disks() */
- if (nl_disk[0].n_type == 0) return; /* ditto. */
-
- for (i = 0, p = dkdisks; i < n_disks; p = d.dk_link.tqe_next, ++i)
- {
- if (kvm_read(kvmd, (u_long)p, &d, sizeof(d)) == sizeof(d))
- {
- if (kvm_read(kvmd, (u_long)d.dk_name, buf, sizeof(buf)) != sizeof(buf))
- /* fallback to default name if kvm_read failed */
- sprintf(buf, "%s%c", _("Disk"), 'A' + i);
-
- /* It seems impossible to get the read and write transfers
- * separately. Its just a matter of choice to put the total in
- * the rbytes member but I like the blue color so much.
- */
-
- /* Separate read/write stats were implemented in NetBSD 1.6K.
- */
-
-#if (__NetBSD_Version__ >= 106110000) || defined(__OpenBSD__)
- rbytes = d.dk_rbytes;
- wbytes = d.dk_wbytes;
-#else
- rbytes = d.dk_bytes;
- wbytes = 0;
-#endif
-
- gkrellm_disk_assign_data_by_name(buf, rbytes, wbytes, FALSE);
- }
- }
-}
-
-gboolean
-gkrellm_sys_disk_init(void)
-{
- struct disklist_head head;
-
-
- if (kvmd == NULL) return FALSE;
-
- /* get disk count */
- if (kvm_nlist(kvmd, nl_disk) >= 0 && nl_disk[0].n_type != 0)
- if (kvm_read(kvmd, nl_disk[X_DISK_COUNT].n_value,
- (char *)&n_disks, sizeof(n_disks)) != sizeof(n_disks))
- n_disks = 0;
-
- /* get first disk */
- if (n_disks > 0) {
- if (kvm_read(kvmd, nl_disk[X_DISKLIST].n_value,
- &head, sizeof(head)) != sizeof(head))
- n_disks = 0;
-
- dkdisks = head.tqh_first;
- }
- return TRUE;
-}
-
-
-/* ===================================================================== */
/* Inet monitor interface */
+#if defined(__OpenBSD__) || ( defined(__NetBSD__) && __NetBSD_Version__ < 399000100 )
+
#include "../inet.h"
/* NO IPv6 SUPPORT YET */
@@ -193,6 +93,7 @@ gkrellm_sys_inet_read_tcp_data(void)
next = (struct inpcb *)inpcb.inp_queue.cqe_next;
}
}
+#endif
gboolean
gkrellm_sys_inet_init(void)
@@ -201,95 +102,6 @@ gkrellm_sys_inet_init(void)
}
/* ===================================================================== */
-/* Memory/Swap monitor interface */
-
-#include <sys/vmmeter.h>
-#include <sys/sysctl.h>
-#include <uvm/uvm_extern.h>
-#include <kvm.h>
-
-static gulong swapin,
- swapout;
-static guint64 swap_total,
- swap_used;
-
-void
-gkrellm_sys_mem_read_data(void)
-{
- static int mib[] = { CTL_VM, VM_METER };
- static int pgout, pgin;
- unsigned long total, used, x_used, free, shared, buffers, cached;
- struct vmtotal vmt;
- struct uvmexp uvmexp;
- size_t len;
- static struct nlist nl[] = {
-#define X_UVM_EXP 0
- { "_uvmexp" },
- { NULL }
-};
-
-
- if (kvmd == NULL) return;
-
- /* get the name list if it's not done yet */
- if (nl[0].n_type == 0) kvm_nlist(kvmd, nl);
-
- if (nl[0].n_type != 0)
- if (kvm_read(kvmd, nl[X_UVM_EXP].n_value,
- &uvmexp, sizeof(uvmexp)) != sizeof(uvmexp))
- memset(&uvmexp, 0, sizeof(uvmexp));
-
- if (sysctl(mib, 2, &vmt, &len, NULL, 0) < 0)
- memset(&vmt, 0, sizeof(vmt));
-
- total = (uvmexp.npages - uvmexp.wired) << uvmexp.pageshift;
-
- /* not sure of what must be computed */
- x_used = (uvmexp.active + uvmexp.inactive) << uvmexp.pageshift;
- free = uvmexp.free << uvmexp.pageshift;
- shared = vmt.t_rmshr << uvmexp.pageshift;
-
- /* want to see only this in the chat. this could be changed */
- used = uvmexp.active << uvmexp.pageshift;
-
- /* don't know how to get those values */
- buffers = 0;
- cached = 0;
-
- gkrellm_mem_assign_data(total, used, free, shared, buffers, cached);
-
- /* show only the pages located on the disk and not in memory */
- swap_total = (guint64) (uvmexp.swpages << uvmexp.pageshift);
- swap_used = (guint64) (uvmexp.swpgonly << uvmexp.pageshift);
-
- /* For page in/out operations, uvmexp struct doesn't seem to be reliable */
-
- /* if the number of swapped pages that are in memory (inuse - only) is
- * greater that the previous value (pgin), we count this a "page in" */
- if (uvmexp.swpginuse - uvmexp.swpgonly > pgin)
- swapin += uvmexp.swpginuse - uvmexp.swpgonly - pgin;
- pgin = uvmexp.swpginuse - uvmexp.swpgonly;
-
- /* same for page out */
- if (uvmexp.swpgonly > pgout)
- swapout += uvmexp.swpgonly - pgout;
- pgout = uvmexp.swpgonly;
-}
-
-void
-gkrellm_sys_swap_read_data(void)
- {
- gkrellm_swap_assign_data(swap_total, swap_used, swapin, swapout);
- }
-
-gboolean
-gkrellm_sys_mem_init(void)
- {
- return TRUE;
- }
-
-
-/* ===================================================================== */
/* Battery monitor interface */
#include <sys/ioctl.h>