diff --git a/sysutils/wmmon/Makefile b/sysutils/wmmon/Makefile index bf9ed85e93e..87f3cb9d73b 100644 --- a/sysutils/wmmon/Makefile +++ b/sysutils/wmmon/Makefile @@ -1,8 +1,10 @@ -# $OpenBSD: Makefile,v 1.2 2001/01/18 16:10:02 naddy Exp $ +# $OpenBSD: Makefile,v 1.3 2001/04/14 02:38:31 naddy Exp $ + +COMMENT= WindowMaker dock app similar to xload DISTNAME= wmmon-1.0b2 CATEGORIES= sysutils x11 x11/windowmaker -NEED_VERSION= 1.338 +NEED_VERSION= 1.364 MASTER_SITES= http://linux.tucows.com/files/x11/dock/ MAINTAINER= Vladimir Popov diff --git a/sysutils/wmmon/patches/patch-wmmon_Makefile b/sysutils/wmmon/patches/patch-wmmon_Makefile index 8360bcf3a0d..a41c67dc649 100644 --- a/sysutils/wmmon/patches/patch-wmmon_Makefile +++ b/sysutils/wmmon/patches/patch-wmmon_Makefile @@ -1,6 +1,6 @@ -$OpenBSD: patch-wmmon_Makefile,v 1.1.1.1 2000/11/18 13:53:32 naddy Exp $ ---- wmmon/Makefile.orig Tue May 19 23:13:16 1998 -+++ wmmon/Makefile Tue Oct 10 22:02:42 2000 +$OpenBSD: patch-wmmon_Makefile,v 1.2 2001/04/14 02:38:31 naddy Exp $ +--- wmmon/Makefile.orig Sat Mar 17 11:25:25 2001 ++++ wmmon/Makefile Sat Mar 17 11:25:25 2001 @@ -1,19 +1,27 @@ -LIBDIR = -L/usr/X11R6/lib -LIBS = -lXpm -lXext -lX11 @@ -22,7 +22,7 @@ $OpenBSD: patch-wmmon_Makefile,v 1.1.1.1 2000/11/18 13:53:32 naddy Exp $ .c.o: - cc -c -O2 -Wall $< -o $*.o -+ ${CC} -c $(CFLAGS) $< -o $*.o ++ ${CC} -c $(CFLAGS) $< -o $@ + +$(PROG): $(OBJS) + ${CC} -o $@ $> $(LIBDIR) $(LIBS) diff --git a/sysutils/wmmon/patches/patch-wmmon_wmmon_c b/sysutils/wmmon/patches/patch-wmmon_wmmon_c index ebbdf27cc99..da9ec51a229 100644 --- a/sysutils/wmmon/patches/patch-wmmon_wmmon_c +++ b/sysutils/wmmon/patches/patch-wmmon_wmmon_c @@ -1,6 +1,6 @@ -$OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ ---- wmmon/wmmon.c.orig Tue May 19 23:13:16 1998 -+++ wmmon/wmmon.c Tue Oct 10 21:59:35 2000 +$OpenBSD: patch-wmmon_wmmon_c,v 1.2 2001/04/14 02:38:31 naddy Exp $ +--- wmmon/wmmon.c.orig Wed May 20 03:13:16 1998 ++++ wmmon/wmmon.c Thu Apr 5 23:52:44 2001 @@ -28,6 +28,10 @@ Changes: ---- @@ -12,11 +12,12 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ 18/05/1998 (Antoine Nulle, warp@xs4all.nl) * MEM/SWAP/UPTIME only updated when visible * Using global file descriptors to reduce file -@@ -72,10 +76,21 @@ +@@ -72,10 +76,22 @@ #include #include +#include ++#include + #include #include @@ -34,7 +35,7 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ #include #include #include -@@ -102,9 +117,28 @@ +@@ -102,9 +118,28 @@ char *ProgName; int stat_current = 0; /* now global */ @@ -66,7 +67,7 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ /* functions */ void usage(void); -@@ -114,7 +148,12 @@ void DrawStats_io(int *, int, int, int, +@@ -114,7 +149,11 @@ void DrawStats_io(int *, int, int, int, void wmmon_routine(int, char **); @@ -74,22 +75,24 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ +/* OpenBSD specific functions */ +#define pagetok(size) ((size) << pageshift) +int swapmode(long *, long *); -+int check_nlist(struct nlist *nlst); + +int main(int argc, char *argv[]) { int i; -@@ -155,6 +194,8 @@ void main(int argc, char *argv[]) { +@@ -154,7 +193,11 @@ void main(int argc, char *argv[]) { + } } ++ signal(SIGPIPE, exit); ++ wmmon_routine(argc, argv); + + return 0; } /*******************************************************************************\ -@@ -213,8 +254,9 @@ void wmmon_routine(int argc, char **argv +@@ -213,8 +256,9 @@ void wmmon_routine(int argc, char **argv long istat; long idle; @@ -101,7 +104,7 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ char *p; int xpm_X = 0, xpm_Y = 0; -@@ -223,16 +265,57 @@ void wmmon_routine(int argc, char **argv +@@ -223,22 +267,58 @@ void wmmon_routine(int argc, char **argv long ref_time = 0; long cnt_time; @@ -116,8 +119,7 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ + /* get the page size and calculate pageshift from it */ + pagesize = sysconf(_SC_PAGESIZE); + pageshift = 0; -+ while (pagesize > 1) -+ { ++ while (pagesize > 1) { + pageshift++; + pagesize >>= 1; + } @@ -136,11 +138,14 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ + + if (kd) { + if (kvm_nlist(kd, nlst) >= 0) { -+ -+ if ( check_nlist(nlst) > 0 ) { -+ kvm_close(kd); -+ exit(-1); -+ } ++ int i; ++ for ( i = 0; nlst[i].n_name == NULL; i++) ++ if (nlst[i].n_type == 0) { ++ /* this one wasn't found */ ++ (void) fprintf(stderr, "kernel: no symbol named `%s'\n", nlst[i].n_name); ++ kvm_close(kd); ++ exit(-1); ++ } - fp = fopen("/proc/uptime", "r"); - fp_meminfo = fopen("/proc/meminfo", "r"); @@ -158,17 +163,18 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ + dk_drivehead = disk_head.tqh_first; + } + } -+ -+ //fprintf (stderr, "Monitoring %d devices for activity.\n", ndrives); -+ -+ } -+ else { -+ fprintf(stderr, "kvm_nlist: %s\n", kvm_geterr(kd)); -+ } ++ } else fprintf(stderr, "kvm_nlist: %s\n", kvm_geterr(kd)); } for (i=0; irt_idle = pagetok(total.t_rm); @@ -296,7 +312,7 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ } /*******************************************************************************\ -@@ -545,10 +614,8 @@ void update_stat_swp(stat_dev *st) { +@@ -545,48 +606,41 @@ void update_stat_swp(stat_dev *st) { void get_statistics(char *devname, long *is, long *ds, long *idle) { int i; @@ -309,10 +325,10 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ long maxdiskio=0; *is = 0; -@@ -556,34 +623,37 @@ void get_statistics(char *devname, long + *ds = 0; *idle = 0; - if (!strncmp(devname, "cpu", 3)) { +- if (!strncmp(devname, "cpu", 3)) { - fseek(fp_stat, 0, SEEK_SET); - while (fgets(temp, 128, fp_stat)) { - if (strstr(temp, "cpu")) { @@ -321,32 +337,41 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ - for (i=0; i<3; i++) { - p = strtok(NULL, tokens); - *ds += atol(p); -+ if (kd) { -+ if (kvm_nlist(kd, nlst) >= 0) { -+ if (nlst[0].n_type != 0) { +- } +- p = strtok(NULL, tokens); +- *idle = atol(p); +- } +- } +- fp_loadavg = freopen("/proc/loadavg", "r", fp_loadavg); +- fscanf(fp_loadavg, "%f", &f); +- *is = (long) (100 * f); +- } ++ if (!strncmp(devname, "cpu", 3)) ++ if (kd) ++ if (kvm_nlist(kd, nlst) >= 0) ++ if (nlst[0].n_type != 0) + if ((kvm_read(kd, nlst[X_CP_TIME].n_value, (char *)&cp_time, sizeof(cp_time))==sizeof(cp_time)) && + (kvm_read(kd, nlst[X_AVERUN].n_value, (char *)&averun, sizeof(averun))==sizeof(averun))) { + *is = (long) (100 * ((double)averun[0] / FSCALE)); + -+ for (i = 0; i < CPUSTATES; i++) { ++ for (i = 0; i < CPUSTATES; i++) + if (i != CP_IDLE) *ds += cp_time[i]; -+ } + *idle = cp_time[CP_IDLE]; + } - } -- p = strtok(NULL, tokens); -- *idle = atol(p); - } - } -- fp_loadavg = freopen("/proc/loadavg", "r", fp_loadavg); -- fscanf(fp_loadavg, "%f", &f); -- *is = (long) (100 * f); - } if (!strncmp(devname, "i/o", 3)) { + struct disk cur_disk, *p; + + p = dk_drivehead; ++ ++ if (kd) ++ if (kvm_nlist(kd, nlst) >= 0) ++ if (nlst[0].n_type != 0) ++ for (i = 0; i < ndrives; i++) ++ if ( kvm_read(kd, (u_long)p, &cur_disk, sizeof(cur_disk)) == sizeof(cur_disk) ) { ++ *ds += cur_disk.dk_seek; ++ p = cur_disk.dk_link.tqe_next; ++ } - fseek(fp_stat, 0, SEEK_SET); - while (fgets(temp, 128, fp_stat)) { @@ -356,19 +381,13 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ - for (i=0; i<4; i++) { - p = strtok(NULL, tokens); - *ds += atol(p); -+ if (kd) { -+ if (kvm_nlist(kd, nlst) >= 0) { -+ if (nlst[0].n_type != 0) { -+ for (i = 0; i < ndrives; i++) { -+ if ( kvm_read(kd, (u_long)p, &cur_disk, sizeof(cur_disk)) == sizeof(cur_disk) ) { -+ *ds += cur_disk.dk_seek; -+ p = cur_disk.dk_link.tqe_next; -+ } -+ } - } - } - } -@@ -597,9 +667,9 @@ void get_statistics(char *devname, long +- } +- } +- } + if (*ds > maxdiskio) maxdiskio = *ds; + } + } +@@ -597,9 +651,9 @@ void get_statistics(char *devname, long int checksysdevs(void) { @@ -381,10 +400,11 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ return 3; } -@@ -737,3 +807,59 @@ void printversion(void) { +@@ -736,4 +790,34 @@ void printversion(void) { + if (!strcmp(ProgName, "wmmon")) { fprintf(stderr, "%s\n", WMMON_VERSION); } - } ++} + +int swapmode(long *used, long *total) { + int nswap, rnswap, i; @@ -406,38 +426,12 @@ $OpenBSD: patch-wmmon_wmmon_c,v 1.1.1.1 2000/11/18 13:53:33 naddy Exp $ + + /* Total things up */ + *total = *used = 0; -+ for (i = 0; i < nswap; i++) { ++ for (i = 0; i < nswap; i++) + if (swdev[i].se_flags & SWF_ENABLE) { + *used += (swdev[i].se_inuse / (1024/DEV_BSIZE)); + *total += (swdev[i].se_nblks / (1024/DEV_BSIZE)); + } -+ } + + free (swdev); + return 1; -+} -+ -+int check_nlist(struct nlist *nlst) -+{ -+ register int i; -+ -+ /* check to see if we got ALL the symbols we requested */ -+ /* this will write one line to stderr for every symbol not found */ -+ -+ i = 0; -+ while (nlst->n_name != NULL) -+ { -+ if (nlst->n_type == 0) -+ { -+ /* this one wasn't found */ -+ (void) fprintf(stderr, "kernel: no symbol named `%s'\n", nlst->n_name); -+ -+ i = 1; -+ } -+ nlst++; -+ } -+ -+ return(i); -+} -+ -+/* vim:ts=4:sw=4: */ + } diff --git a/sysutils/wmmon/pkg/COMMENT b/sysutils/wmmon/pkg/COMMENT deleted file mode 100644 index e72cb4e4eb2..00000000000 --- a/sysutils/wmmon/pkg/COMMENT +++ /dev/null @@ -1 +0,0 @@ -WindowMaker dock app similar to xload diff --git a/sysutils/wmmon/pkg/DESCR b/sysutils/wmmon/pkg/DESCR index e4b56e509f8..bdc01c0397d 100644 --- a/sysutils/wmmon/pkg/DESCR +++ b/sysutils/wmmon/pkg/DESCR @@ -14,7 +14,7 @@ WMMon currently provides: * Commandline options for help (-h), version (-v), start mode (-i & -s) and display (-d); -WMMon can lauch 3 user definable commands for left, middle and +WMMon can launch 3 user definable commands for left, middle and right mouse button clicks, which you can define in ~/.wmmonrc: left: mycommand-1 &