pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/torsmo Torsmo is a system monitor that sits i...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/db891b3847f0
branches:  trunk
changeset: 510378:db891b3847f0
user:      ghen <ghen%pkgsrc.org@localhost>
date:      Wed Mar 29 21:42:55 2006 +0000

description:
Torsmo is a system monitor that sits in the corner of your desktop. It's
very simple, customizable and it renders only text on the desktop (and
percentagebars if you want it to ;) and the only lib it uses is Xlib.
Torsmo can show various information about your system and it's peripherals,
including:

* Kernel version
* Uptime
* System time
* Network interface information
* Memory and swap usage
* Hostname
* Machine, i686 for example
* System name, Linux for example
* Temperatures from i2c-sensors
* Temperature from ACPI
* Battery capacity from ACPI/APM
* Number of processes running or sleeping
* Local mails (unread and all)
* Filesystem stats

diffstat:

 sysutils/torsmo/DESCR            |   20 +++++
 sysutils/torsmo/Makefile         |   33 ++++++++
 sysutils/torsmo/PLIST            |    8 ++
 sysutils/torsmo/distinfo         |    8 ++
 sysutils/torsmo/patches/patch-aa |   43 ++++++++++
 sysutils/torsmo/patches/patch-ab |  155 +++++++++++++++++++++++++++++++++++++++
 sysutils/torsmo/patches/patch-ac |   19 ++++
 7 files changed, 286 insertions(+), 0 deletions(-)

diffs (truncated from 314 to 300 lines):

diff -r 33b684b3aa3f -r db891b3847f0 sysutils/torsmo/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/torsmo/DESCR     Wed Mar 29 21:42:55 2006 +0000
@@ -0,0 +1,20 @@
+Torsmo is a system monitor that sits in the corner of your desktop. It's
+very simple, customizable and it renders only text on the desktop (and
+percentagebars if you want it to ;) and the only lib it uses is Xlib.
+Torsmo can show various information about your system and it's peripherals,
+including:
+
+* Kernel version
+* Uptime
+* System time
+* Network interface information
+* Memory and swap usage
+* Hostname
+* Machine, i686 for example
+* System name, Linux for example
+* Temperatures from i2c-sensors
+* Temperature from ACPI
+* Battery capacity from ACPI/APM
+* Number of processes running or sleeping
+* Local mails (unread and all)
+* Filesystem stats
diff -r 33b684b3aa3f -r db891b3847f0 sysutils/torsmo/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/torsmo/Makefile  Wed Mar 29 21:42:55 2006 +0000
@@ -0,0 +1,33 @@
+# $NetBSD: Makefile,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+DISTNAME=      torsmo-0.18
+CATEGORIES=    sysutils
+MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=torsmo/}
+
+MAINTAINER=    ghen%NetBSD.org@localhost
+HOMEPAGE=      http://torsmo.sourceforge.net/
+COMMENT=       Tyopoytaorvelo System Monitor
+
+GNU_CONFIGURE= yes
+
+EGDIR=         ${PREFIX}/share/examples/torsmo
+DOCDIR=                ${PREFIX}/share/doc/torsmo
+
+.include "../../mk/bsd.prefs.mk"
+
+.if (${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD" \
+                         || ${OPSYS} == "OpenBSD" || ${OPSYS} == "Linux")
+SPECIAL_PERMS+=        bin/torsmo ${ROOT_USER} kmem 2555
+.endif
+
+do-install:
+       ${INSTALL_PROGRAM} ${WRKSRC:Q}/torsmo ${PREFIX:Q}/bin/
+       ${INSTALL_MAN} ${WRKSRC:Q}/torsmo.1 ${PREFIX:Q}/${PKGMANDIR:Q}/man1/
+       ${INSTALL_DATA_DIR} ${EGDIR:Q}
+       ${INSTALL_DATA} ${WRKSRC:Q}/torsmorc.sample ${EGDIR:Q}/
+       ${INSTALL_DATA_DIR} ${DOCDIR:Q}
+       ${INSTALL_DATA} ${WRKSRC:Q}/README ${DOCDIR:Q}/
+       ${INSTALL_DATA} ${WRKSRC:Q}/readme.html ${DOCDIR:Q}/
+
+.include "../../mk/x11.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r 33b684b3aa3f -r db891b3847f0 sysutils/torsmo/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/torsmo/PLIST     Wed Mar 29 21:42:55 2006 +0000
@@ -0,0 +1,8 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+bin/torsmo
+man/man1/torsmo.1
+share/doc/torsmo/README
+share/doc/torsmo/readme.html
+share/examples/torsmo/torsmorc.sample
+@dirrm share/examples/torsmo
+@dirrm share/doc/torsmo
diff -r 33b684b3aa3f -r db891b3847f0 sysutils/torsmo/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/torsmo/distinfo  Wed Mar 29 21:42:55 2006 +0000
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+SHA1 (torsmo-0.18.tar.gz) = 01e6737b3971daa3a7c9cb6dd1961f61bc39bdae
+RMD160 (torsmo-0.18.tar.gz) = f1d8b3c4679155596569f9116970e7ba8a01eb6e
+Size (torsmo-0.18.tar.gz) = 84020 bytes
+SHA1 (patch-aa) = b1d9e3eb7638e24c3cc595e9cd1e1c6054adf5cf
+SHA1 (patch-ab) = 3bf66bd2b7645c204099a8c7b806098d028cc8bf
+SHA1 (patch-ac) = 5b342d09ff0fcc3982aa855e2cc660823ed53e11
diff -r 33b684b3aa3f -r db891b3847f0 sysutils/torsmo/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/torsmo/patches/patch-aa  Wed Mar 29 21:42:55 2006 +0000
@@ -0,0 +1,43 @@
+$NetBSD: patch-aa,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+--- fs.c.orig  2004-08-25 18:24:24.000000000 +0200
++++ fs.c
+@@ -19,6 +19,11 @@
+ #include <sys/mount.h>
+ #endif
+ 
++#if defined (__NetBSD__)
++#include <sys/statvfs.h>
++#define STATVFS 1
++#endif
++
+ /* TODO: benchmark which is faster, fstatvfs() or pre-opened fd and
+  * statvfs() (fstatvfs() would handle mounts I think...) */
+ 
+@@ -27,16 +32,25 @@ struct fs_stat *fs_stats = fs_stats_;
+ 
+ void update_fs_stats() {
+   unsigned int i;
++#ifndef STATVFS
+   struct statfs s;
++#else
++  struct statvfs s;
++#endif
+   for (i=0; i<16; i++) {
+     if (fs_stats[i].fd <= 0)
+       break;
+ 
++#ifndef STATVFS
+     fstatfs(fs_stats[i].fd, &s);
+-
+     fs_stats[i].size = (long long) s.f_blocks * s.f_bsize;
+     /* bfree (root) or bavail (non-roots) ? */
+     fs_stats[i].avail = (long long) s.f_bavail * s.f_bsize;
++#else
++    fstatvfs(fs_stats[i].fd, &s);
++    fs_stats[i].size = (int64_t) s.f_blocks * 1024;
++    fs_stats[i].avail = (int64_t) s.f_bavail * 1024;
++#endif
+   }
+ }
+ 
diff -r 33b684b3aa3f -r db891b3847f0 sysutils/torsmo/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/torsmo/patches/patch-ab  Wed Mar 29 21:42:55 2006 +0000
@@ -0,0 +1,155 @@
+$NetBSD: patch-ab,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+--- netbsd.c.orig      2004-08-25 19:55:57.000000000 +0200
++++ netbsd.c
+@@ -9,6 +9,7 @@
+ #include <err.h>
+ #include <limits.h>
+ #include <paths.h>
++#include <ctype.h>
+ 
+ #include <kvm.h>
+ #include <nlist.h>
+@@ -221,6 +222,33 @@ void update_net_stats() 
+     }
+ }
+ 
++static char *freq = NULL;
++char * get_freq()
++{
++    size_t val_len;
++    u_int32_t val;
++
++    if (freq == NULL) {
++        freq = malloc(10);
++        if (freq == NULL) {
++            return NULL;
++        } else {
++            freq[0] = '\0';
++        }
++    }
++
++    /* Laptops with enhanced speed step. */
++    if (sysctlbyname("machdep.est.frequency.current",
++                     NULL, &val_len, NULL, 0) == 0) {
++        sysctlbyname("machdep.est.frequency.current", &val, &val_len, NULL, 0);
++        sprintf(freq, "%d", val);
++    } else {
++        /* XXX: Parse out the clockspeed from machdep.cpu_brand */
++    }
++
++    return freq;
++}
++
+ void update_total_processes() 
+ {
+     /* It's easier to use kvm here than sysctl */
+@@ -302,6 +330,7 @@ void update_cpu_usage() 
+ }
+ 
+ double get_i2c_info(int fd, int div) {
++    (void) fd; (void) div;
+     return -1;
+ }
+ 
+@@ -315,24 +344,96 @@ void update_load_average() {
+ }
+ 
+ double get_acpi_temperature(int fd) {
++    (void) fd;
+     return -1;
+ }
+ 
+-void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
+-}
+-
+ int open_i2c_sensor(const char *dev, const char *type, int n, int *div)
+ {
++    (void) dev; (void) type; (void) n; (void) div;
+     return -1;
+ }
+ 
+ int open_acpi_temperature(const char *name) {
++    (void) name;
+     return -1;
+ }
+ 
++static char acpi_ac_str[64] = "N/A";
+ char * get_acpi_ac_adapter(void)
+ {
+-    return "N/A";
++    /* get_battery_stuff() actually populates this for us. */
++    return acpi_ac_str;
++}
++
++static char last_battery_str[64];
++static double last_battery_time;
++
++void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
++    FILE *f;
++    char *foo;
++    char b[4096];
++    char b_name[32];
++    int bat_num;
++    int found_acpibat = 0;
++    int found_acpiacad = 0;
++    float bat_charge = 0.0;
++
++    /* Don't update battery too often. */
++    if (current_update_time - last_battery_time < 29.5) {
++        snprintf(buf, n, "%s", last_battery_str);
++        return;
++    }
++    last_battery_time = current_update_time;
++
++    sscanf(bat, "BAT%d", &bat_num);
++    sprintf(b_name, "acpibat%d", bat_num);
++
++    /*
++     * Using the envsys API is like pulling teeth without anesthetic.
++     * so just popen envstat and parse the output instead.
++     */
++    f = popen("/usr/sbin/envstat -r", "r");
++    if (f != NULL) {
++        while(!feof(f)) {
++            fgets(b, 4096, f);
++
++            /* AC adapter state. */
++            if (strstr(b, "acpiacad0")) {
++                if (strstr(b, "disconnected")) {
++                    sprintf(acpi_ac_str, "disconnected");
++                } else {
++                    sprintf(acpi_ac_str, "connected");
++                }
++                found_acpiacad = 1;
++            }
++
++            if (bat && strstr(b, b_name)) {
++                if (strstr(b, "charge:")) {
++                    foo = strstr(b, "%)");
++                    while (*foo != ' ' && *foo != '(') {
++                        foo--;
++                    }
++                    foo = foo + 1;
++                    sscanf(foo, "%f", &bat_charge);
++                    found_acpibat = 1;
++                }
++            }
++        }
++        pclose(f);
++    }
++
++    if (found_acpibat) {
++        snprintf(last_battery_str, 64, "%.2f%%", bat_charge);
++        snprintf(buf, n, "%s", last_battery_str);
++    } else {
++        /* XXX: If that failed, try to use APM. */
++    }
++
++    if (!found_acpiacad) {
++        sprintf(acpi_ac_str, "N/A");
++    }
++
+ }
+ 
+ char* get_acpi_fan() {
diff -r 33b684b3aa3f -r db891b3847f0 sysutils/torsmo/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/torsmo/patches/patch-ac  Wed Mar 29 21:42:55 2006 +0000
@@ -0,0 +1,19 @@
+$NetBSD: patch-ac,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+--- torsmo.c.orig      2004-12-21 23:14:46.000000000 +0100
++++ torsmo.c
+@@ -888,12 +888,14 @@ static void generate_text() {



Home | Main Index | Thread Index | Old Index