diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-01-21 10:48:17 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-01-21 10:48:17 +0000 |
commit | 16a678004a5aa6afafddc55bda1d05bfb0e8db22 (patch) | |
tree | 69c46372045db8efe22c2b64c883de6bf40a1cfa | |
parent | 83df846028ed3a272242276c1d94f86a6c7af2a7 (diff) | |
download | lcd4linux-16a678004a5aa6afafddc55bda1d05bfb0e8db22.tar.gz |
[lcd4linux @ 2004-01-21 10:48:17 by reinelt]
hash_age function added
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@329 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rwxr-xr-x | config.guess | 21 | ||||
-rwxr-xr-x | config.sub | 35 | ||||
-rw-r--r-- | hash.c | 44 | ||||
-rw-r--r-- | hash.h | 13 | ||||
-rwxr-xr-x | libtool | 11 | ||||
-rw-r--r-- | ltmain.sh | 11 | ||||
-rw-r--r-- | plugin_cpuinfo.c | 17 | ||||
-rw-r--r-- | plugin_meminfo.c | 18 | ||||
-rw-r--r-- | plugin_proc_stat.c | 35 | ||||
-rw-r--r-- | plugin_xmms.c | 15 |
10 files changed, 146 insertions, 74 deletions
diff --git a/config.guess b/config.guess index 1127162..e8c6fc0 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-10-07' +timestamp='2004-01-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -221,6 +221,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + pegasos:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -307,6 +310,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; @@ -742,6 +748,11 @@ EOF FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -986,6 +997,9 @@ EOF i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1172,7 +1186,7 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*) + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1216,6 +1230,9 @@ EOF SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; + *:DRAGONFLY:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-10-07' +timestamp='2004-01-05' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -118,7 +118,8 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -379,6 +380,9 @@ case $basic_machine in amd64) basic_machine=x86_64-pc ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -743,6 +747,10 @@ case $basic_machine in basic_machine=or32-unknown os=-coff ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose @@ -963,6 +971,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -1137,13 +1149,13 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1182,6 +1194,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1203,6 +1218,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1225,6 +1243,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1473,9 +1494,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1,4 +1,4 @@ -/* $Id: hash.c,v 1.6 2004/01/20 05:36:59 reinelt Exp $ +/* $Id: hash.c,v 1.7 2004/01/21 10:48:17 reinelt Exp $ * * hashes (associative arrays) * @@ -23,6 +23,9 @@ * * * $Log: hash.c,v $ + * Revision 1.7 2004/01/21 10:48:17 reinelt + * hash_age function added + * * Revision 1.6 2004/01/20 05:36:59 reinelt * moved text-display-specific stuff to drv_generic_text * moved all the bar stuff from drv_generic_bar to generic_text @@ -142,6 +145,7 @@ static HASH_ITEM* hash_set_string (HASH *Hash, char *key, char *val) if (Item!=NULL) { if (Item->val) free (Item->val); Item->val = strdup(val); + gettimeofday(&(Item->time), NULL); return Item; } @@ -155,7 +159,11 @@ static HASH_ITEM* hash_set_string (HASH *Hash, char *key, char *val) Item->key = strdup(key); Item->val = strdup(val); Item->Slot = NULL; - + + // set timestamps + gettimeofday(&Hash->time, NULL); + Item->time=Hash->time; + return Item; } @@ -199,11 +207,41 @@ char *hash_get (HASH *Hash, char *key) return Item?Item->val:NULL; } + +// return the age in milliseconds of an entry from the hash table +// or from the hash table itself if key is NULL +// returns -1 if entry does not exist +// if **value is set, return the value, too +int hash_age (HASH *Hash, char *key, char **value) +{ + HASH_ITEM *Item; + timeval now, *stamp; + int age; + + if (key!=NULL) { + Item=hash_lookup(Hash, key, 1); + if (value) *value=Item?Item->val:NULL; + if (Item==NULL) { + return -1; + } + stamp=&Item->time; + } else { + stamp=&Hash->time; + } + + gettimeofday(&now, NULL); + + age = (now.tv_sec - stamp->tv_sec)*1000 + (now.tv_usec - stamp->tv_usec)/1000; + + return age; +} + + // get a delta value from the filter table double hash_get_filter (HASH *Hash, char *key, int delay) { HASH_ITEM *Item; - struct timeval now, end; + timeval now, end; int i; double dv, dt; @@ -1,4 +1,4 @@ -/* $Id: hash.h,v 1.5 2004/01/18 09:01:45 reinelt Exp $ +/* $Id: hash.h,v 1.6 2004/01/21 10:48:17 reinelt Exp $ * * hashes (associative arrays) * @@ -23,6 +23,9 @@ * * * $Log: hash.h,v $ + * Revision 1.6 2004/01/21 10:48:17 reinelt + * hash_age function added + * * Revision 1.5 2004/01/18 09:01:45 reinelt * /proc/stat parsing finished * @@ -53,22 +56,25 @@ // struct timeval #include <sys/time.h> +typedef struct timeval timeval; typedef struct { - struct timeval time; - double val; + timeval time; + double val; } HASH_SLOT; typedef struct { char *key; char *val; + timeval time; HASH_SLOT *Slot; } HASH_ITEM; typedef struct { int sorted; + timeval time; int nItems; HASH_ITEM *Items; } HASH; @@ -76,6 +82,7 @@ typedef struct { void hash_set (HASH *Hash, char *key, char *val); void hash_set_filter (HASH *Hash, char *key, char *val); +int hash_age (HASH *Hash, char *key, char **value); char *hash_get (HASH *Hash, char *key); double hash_get_filter (HASH *Hash, char *key, int delay); void hash_destroy (HASH *Hash); @@ -400,7 +400,7 @@ modename="$progname" PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.0a -TIMESTAMP=" (1.1220.2.35 2003/11/12 18:51:58) Debian$Rev: 159 $" +TIMESTAMP=" (1.1220.2.35 2003/11/12 18:51:58) Debian$Rev: 179 $" default_mode= help="Try \`$progname --help' for more information." @@ -1202,7 +1202,7 @@ EOF ;; esac libtool_args="$nonopt" - base_compile="$nonopt" + base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" @@ -1252,7 +1252,7 @@ EOF # Only attempt this if the compiler in the base link # command doesn't match the default compiler. if test -n "$available_tags" && test -z "$tagname"; then - case "$base_compile " in + case $base_compile in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; @@ -1263,7 +1263,7 @@ EOF if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in + case $base_compile in "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) # The compiler in $compile_command matches # the one in the tagged configuration. @@ -1319,7 +1319,6 @@ EOF # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" - base_compile="$base_compile $arg" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") @@ -5982,7 +5981,7 @@ relink_command=\"$relink_command\"" tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue @@ -56,7 +56,7 @@ modename="$progname" PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.0a -TIMESTAMP=" (1.1220.2.35 2003/11/12 18:51:58) Debian$Rev: 159 $" +TIMESTAMP=" (1.1220.2.35 2003/11/12 18:51:58) Debian$Rev: 179 $" default_mode= help="Try \`$progname --help' for more information." @@ -858,7 +858,7 @@ EOF ;; esac libtool_args="$nonopt" - base_compile="$nonopt" + base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" @@ -908,7 +908,7 @@ EOF # Only attempt this if the compiler in the base link # command doesn't match the default compiler. if test -n "$available_tags" && test -z "$tagname"; then - case "$base_compile " in + case $base_compile in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; @@ -919,7 +919,7 @@ EOF if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in + case $base_compile in "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) # The compiler in $compile_command matches # the one in the tagged configuration. @@ -975,7 +975,6 @@ EOF # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" - base_compile="$base_compile $arg" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") @@ -5638,7 +5637,7 @@ relink_command=\"$relink_command\"" tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue diff --git a/plugin_cpuinfo.c b/plugin_cpuinfo.c index 1102056..fc98789 100644 --- a/plugin_cpuinfo.c +++ b/plugin_cpuinfo.c @@ -1,4 +1,4 @@ -/* $Id: plugin_cpuinfo.c,v 1.5 2004/01/16 11:12:26 reinelt Exp $ +/* $Id: plugin_cpuinfo.c,v 1.6 2004/01/21 10:48:17 reinelt Exp $ * * plugin for /proc/cpuinfo parsing * @@ -23,6 +23,9 @@ * * * $Log: plugin_cpuinfo.c,v $ + * Revision 1.6 2004/01/21 10:48:17 reinelt + * hash_age function added + * * Revision 1.5 2004/01/16 11:12:26 reinelt * some bugs in plugin_xmms fixed, parsing moved to own function * plugin_proc_stat nearly finished @@ -62,24 +65,23 @@ #include <string.h> #include <ctype.h> #include <errno.h> -#include <time.h> #include "debug.h" #include "plugin.h" #include "hash.h" -static HASH CPUinfo = { 0, 0, NULL }; +static HASH CPUinfo = { 0, }; static int parse_cpuinfo (void) { - static time_t now=0; + int age; FILE *stream; - + // reread every second only - if (time(NULL)==now) return 0; - time(&now); + age=hash_age(&CPUinfo, NULL, NULL); + if (age>0 && age<=1000) return 0; stream=fopen("/proc/cpuinfo", "r"); @@ -136,4 +138,3 @@ int plugin_init_cpuinfo (void) AddFunction ("cpuinfo", 1, my_cpuinfo); return 0; } - diff --git a/plugin_meminfo.c b/plugin_meminfo.c index ec8e611..b455f71 100644 --- a/plugin_meminfo.c +++ b/plugin_meminfo.c @@ -1,4 +1,4 @@ -/* $Id: plugin_meminfo.c,v 1.2 2004/01/16 07:26:25 reinelt Exp $ +/* $Id: plugin_meminfo.c,v 1.3 2004/01/21 10:48:17 reinelt Exp $ * * plugin for /proc/meminfo parsing * @@ -23,6 +23,9 @@ * * * $Log: plugin_meminfo.c,v $ + * Revision 1.3 2004/01/21 10:48:17 reinelt + * hash_age function added + * * Revision 1.2 2004/01/16 07:26:25 reinelt * moved various /proc parsing to own functions * made some progress with /proc/stat parsing @@ -49,7 +52,6 @@ #include <string.h> #include <ctype.h> #include <errno.h> -#include <time.h> #include "debug.h" #include "plugin.h" @@ -57,18 +59,18 @@ #include "hash.h" -static HASH MemInfo = { 0, 0, NULL }; +static HASH MemInfo = { 0, }; static int parse_meminfo (void) { - static time_t now=0; - FILE *stream; + int age; int line; + FILE *stream; - // reread every second only - if (time(NULL)==now) return 0; - time(&now); + // reread every 100 msec only + age=hash_age(&MemInfo, NULL, NULL); + if (age>0 && age<=100) return 0; stream=fopen("/proc/meminfo", "r"); if (stream==NULL) { diff --git a/plugin_proc_stat.c b/plugin_proc_stat.c index 52c0ad6..d7d56c8 100644 --- a/plugin_proc_stat.c +++ b/plugin_proc_stat.c @@ -1,4 +1,4 @@ -/* $Id: plugin_proc_stat.c,v 1.6 2004/01/20 12:45:47 reinelt Exp $ +/* $Id: plugin_proc_stat.c,v 1.7 2004/01/21 10:48:17 reinelt Exp $ * * plugin for /proc/stat parsing * @@ -23,6 +23,9 @@ * * * $Log: plugin_proc_stat.c,v $ + * Revision 1.7 2004/01/21 10:48:17 reinelt + * hash_age function added + * * Revision 1.6 2004/01/20 12:45:47 reinelt * "Default screen" working with MatrixOrbital * @@ -63,36 +66,13 @@ #include <string.h> #include <ctype.h> #include <errno.h> -#include <time.h> -#include <sys/time.h> #include "debug.h" #include "plugin.h" #include "hash.h" -static HASH Stat = { 0, 0, NULL }; - - -static int renew(int msec) -{ - static struct timeval end = {0, 0}; - struct timeval now; - - // update every 10 msec - gettimeofday(&now, NULL); - if (now.tv_sec==end.tv_sec?now.tv_usec<end.tv_usec:now.tv_sec<end.tv_sec) { - return 0; - } - end.tv_sec = now.tv_sec; - end.tv_usec = now.tv_usec + 1000*msec; - while (end.tv_usec > 1000000) { - end.tv_usec -= 1000000; - end.tv_sec++; - } - return 1; -} - +static HASH Stat = { 0, }; static void hash_set1 (char *key1, char *val) { @@ -122,8 +102,9 @@ static int parse_proc_stat (void) { FILE *stream; - // update every 10 msec - if (!renew(10)) return 0; + // reread every 10 msec only + age=hash_age(&Stat, NULL, NULL); + if (age>0 && age<=10) return 0; stream=fopen("/proc/stat", "r"); if (stream==NULL) { diff --git a/plugin_xmms.c b/plugin_xmms.c index 4759196..eacf675 100644 --- a/plugin_xmms.c +++ b/plugin_xmms.c @@ -1,4 +1,4 @@ -/* $Id: plugin_xmms.c,v 1.4 2004/01/16 11:12:26 reinelt Exp $ +/* $Id: plugin_xmms.c,v 1.5 2004/01/21 10:48:17 reinelt Exp $ * * XMMS-Plugin for LCD4Linux * Copyright 2003 Markus Keil <markus_keil@t-online.de> @@ -21,6 +21,9 @@ * * * $Log: plugin_xmms.c,v $ + * Revision 1.5 2004/01/21 10:48:17 reinelt + * hash_age function added + * * Revision 1.4 2004/01/16 11:12:26 reinelt * some bugs in plugin_xmms fixed, parsing moved to own function * plugin_proc_stat nearly finished @@ -68,25 +71,23 @@ #include <string.h> #include <stdio.h> #include <ctype.h> -#include <time.h> #include "hash.h" #include "debug.h" #include "plugin.h" -static HASH xmms = { 0, 0, NULL }; +static HASH xmms = { 0, }; static int parse_xmms_info (void) { - static time_t now=0; FILE *xmms_stream; char zeile[200]; - // reread every second only - if (time(NULL)==now) return 0; - time(&now); + // reread every 100msec only + age=hash_age(&xmms, NULL, NULL); + if (age>0 && age<=100) return 0; // Open Filestream for '/tmp/xmms-info' xmms_stream = fopen("/tmp/xmms-info","r"); |