Date: Wed, 18 Dec 2002 03:56:13 +0100 (CET) From: Cyrille Lefevre <cyrille.lefevre@laposte.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Ryan Grove <ryan@wonko.com> Subject: ports/46339: Maintainer update: misc/upclient (5.0b6) Message-ID: <200212180256.gBI2uDqw027876@mail.gits.dyndns.org>
next in thread | raw e-mail | index | archive | help
>Number: 46339 >Category: ports >Synopsis: Maintainer update: misc/upclient (5.0b6) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue Dec 17 19:00:13 PST 2002 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 4.7-STABLE i386 >Organization: ACME >Environment: System: FreeBSD gits 4.7-STABLE FreeBSD 4.7-STABLE #28: Sun Oct 20 17:28:38 CEST 2002 root@gits:/disk2/freebsd/stable/src/sys/compile/CUSTOM i386 >Description: Makefile PORTVERSION bumped LIB_DEPEND added USE_GMAKE required DOC_FILES updated post-extract (rename-doc) and install-locale added patch-prefix updated distinfo updated pkg-plist clientchk added locales added docs updated files/patch-aa (Makefile) files/patch-ab (upclient.conf) files/patch-options.c files/patch-upchk updated files/patch-stats-bsd.c shrinked since FreeBSD patch as been integrated :) files/patch-options.h deleted files/patch-clientchk files/patch-transmit.c new files files/upclient.sh config file version check added >How-To-Repeat: n/a >Fix: take care, this patch set is in two parts. the first one are diffs against /dev/null and the second one is a cvs diff. --- /dev/null Wed Dec 18 03:42:45 2002 +++ files/patch-clientchk Wed Dec 18 02:47:26 2002 @@ -0,0 +1,20 @@ +--- scripts/clientchk.orig Thu Oct 24 18:48:35 2002 ++++ scripts/clientchk Wed Dec 18 02:41:57 2002 +@@ -31,7 +31,7 @@ + # variables: + + # client: This is the path to the client program. +-client="/usr/sbin/upclient" ++client="%%PREFIX%%/sbin/upclient" + + # clientpid: This is the path to the client PID file. + clientpid="/var/run/upclient.pid" +@@ -43,7 +43,7 @@ + + # chdirectroy: If we need to change directory before running the client, + # enter it here. +-chdirectory="" ++chdirectory="/" + + # You can leave deletefiles or chdirector empty if you don't need them. + # However, you NEED client and clientpid. --- /dev/null Wed Dec 18 03:42:45 2002 +++ files/patch-transmit.c Wed Dec 18 03:32:44 2002 @@ -0,0 +1,12 @@ +--- src/transmit.c.orig Sat Nov 30 03:27:16 2002 ++++ src/transmit.c Wed Dec 18 03:30:45 2002 +@@ -45,8 +45,8 @@ + #endif /* !PLATFORM_WINNT */ + + #if !defined PLATFORM_WINNT && !defined PLATFORM_BEOS +-# include <arpa/inet.h> /* htons(), in_addr_t */ + # include <netinet/in.h> ++# include <arpa/inet.h> /* htons(), in_addr_t */ + #endif + /* Some Linux with old system headers might need this */ + /* #if defined PLATFORM_LINUX Index: Makefile =================================================================== RCS file: /home/ncvs/ports/misc/upclient/Makefile,v retrieving revision 1.17 diff -u -r1.17 Makefile --- Makefile 6 Nov 2002 02:06:03 -0000 1.17 +++ Makefile 18 Dec 2002 02:35:25 -0000 @@ -6,7 +6,7 @@ # PORTNAME= upclient -PORTVERSION= 5.0.b5 +PORTVERSION= 5.0.b6 CATEGORIES= misc MASTER_SITES= http://uptimes.wonko.com/files/ DISTNAME= ${PORTNAME}-${PORTVERSION:R}${PORTVERSION:E} @@ -16,7 +16,10 @@ # Global variables # +LIB_DEPENDS= intl.4:${PORTSDIR}/devel/gettext + USE_REINPLACE= yes +USE_GMAKE= yes ALL_TARGET= bsd BUILD_WRKSRC= ${WRKSRC}/src @@ -29,10 +32,19 @@ # DOC_FILES= AUTHORS COPYING FAQ HISTORY INSTALL README TODO +DOC_FILES+= doc/UptimesProtocol5 DOC_FILES+= HISTORY-BETA .include <bsd.port.pre.mk> +# Post-extract +# + +post-extract: rename-doc + +rename-doc: + @${MV} ${WRKSRC}/doc/"Uptimes Protocol 5" ${WRKSRC}/doc/UptimesProtocol5 + # Post-patch # @@ -40,7 +52,9 @@ patch-prefix: @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ - ${WRKSRC}/scripts/upchk ${WRKSRC}/src/Makefile + -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ + ${WRKSRC}/scripts/upchk ${WRKSRC}/scripts/clientchk \ + ${WRKSRC}/src/Makefile patch-pkgmessage: @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE} @@ -48,11 +62,12 @@ # Install # -do-install: install-program install-man install-sample install-script +do-install: install-program install-man install-sample install-script \ + install-locale install-program: @${INSTALL_PROGRAM} -g kmem -m 2555 ${WRKSRC}/src/products/upclient \ - ${PREFIX}/sbin/upclient + ${PREFIX}/sbin install-man: @${INSTALL_MAN} ${WRKSRC}/src/products/upclient.8 \ @@ -63,7 +78,11 @@ ${PREFIX}/etc/upclient.conf.sample install-script: - @${INSTALL_SCRIPT} ${WRKSRC}/scripts/upchk ${PREFIX}/sbin/upchk + @${INSTALL_SCRIPT} ${WRKSRC}/scripts/upchk ${WRKSRC}/scripts/clientchk \ + ${PREFIX}/sbin + +install-locale: + @cd ${WRKSRC}/src; ${GMAKE} install-locales # Post-install # Index: distinfo =================================================================== RCS file: /home/ncvs/ports/misc/upclient/distinfo,v retrieving revision 1.5 diff -u -r1.5 distinfo --- distinfo 19 Oct 2002 22:14:38 -0000 1.5 +++ distinfo 18 Dec 2002 00:11:25 -0000 @@ -1 +1 @@ -MD5 (upclient-5.0b5.tar.gz) = fa6a74f146eacf47f4b0773a835a570e +MD5 (upclient-5.0b6.tar.gz) = 3d4c45addb947a51deabf2205188b82e Index: pkg-plist =================================================================== RCS file: /home/ncvs/ports/misc/upclient/pkg-plist,v retrieving revision 1.4 diff -u -r1.4 pkg-plist --- pkg-plist 19 Oct 2002 22:14:38 -0000 1.4 +++ pkg-plist 18 Dec 2002 02:40:21 -0000 @@ -3,8 +3,16 @@ @unexec if cmp -s %D/etc/upclient.conf %D/etc/upclient.conf.sample; then rm -f %D/etc/upclient.conf; fi etc/upclient.conf.sample @exec [ -f %D/etc/upclient.conf ] || cp -p %D/etc/upclient.conf.sample %D/etc/upclient.conf +sbin/clientchk sbin/upchk sbin/upclient +share/locale/de/LC_MESSAGES/upclient.mo +share/locale/fr/LC_MESSAGES/upclient.mo +@unexec rmdir share/locale/de/LC_MESSAGES 2> /dev/null || : +@unexec rmdir share/locale/de 2> /dev/null || : +@unexec rmdir share/locale/fr/LC_MESSAGES 2> /dev/null || : +@unexec rmdir share/locale/fr 2> /dev/null || : +@unexec rmdir share/locale 2> /dev/null || : %%PORTDOCS%%share/doc/upclient/AUTHORS %%PORTDOCS%%share/doc/upclient/COPYING %%PORTDOCS%%share/doc/upclient/FAQ @@ -13,4 +21,5 @@ %%PORTDOCS%%share/doc/upclient/INSTALL %%PORTDOCS%%share/doc/upclient/README %%PORTDOCS%%share/doc/upclient/TODO +%%PORTDOCS%%share/doc/upclient/UptimesProtocol5 %%PORTDOCS%%@dirrm share/doc/upclient Index: files/patch-aa =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-aa,v retrieving revision 1.4 diff -u -r1.4 patch-aa --- files/patch-aa 19 Oct 2002 22:14:38 -0000 1.4 +++ files/patch-aa 18 Dec 2002 02:17:36 -0000 @@ -1,5 +1,14 @@ ---- src/Makefile.orig Thu Oct 10 04:36:35 2002 -+++ src/Makefile Sat Oct 19 23:21:49 2002 +--- src/Makefile.orig Sat Nov 30 03:29:55 2002 ++++ src/Makefile Wed Dec 18 01:29:34 2002 +@@ -34,7 +34,7 @@ + # + PROGRAMNAME = upclient + # UPCLIENT_VERSION = "5.0b6" +- UPCLIENT_VERSION = `grep '\#define UPCLIENT_VERSION ' version.h | sed -e 's@\#define UPCLIENT_VERSION @@g' | tr -d '"'` ++ UPCLIENT_VERSION = `sed -n 's/"//g;/\#define UPCLIENT_VERSION /s///p' version.h` + ################################################################################ + + binname = upclient @@ -44,7 +44,7 @@ @@ -18,3 +27,16 @@ # Further Reading # Filesystem Hierarchy Standard 2.2 May 24, 2001 +@@ -82,9 +82,9 @@ + + ## [x86] FreeBSD (4.7-RC) + ## assumes gettext installed in /usr/local +-#localedir = ${datadir}/locale +-#LOCALEFLAGS = -DLOCALEPATH=\"$(localedir)\" -I/usr/local/include +-#LOCALELIBS = -L/usr/local/lib -lintl ++localedir = ${datadir}/locale ++LOCALEFLAGS = -DLOCALEPATH=\"$(localedir)\" -I%%LOCALBASE%%/include ++LOCALELIBS = -L%%LOCALBASE%%/lib -lintl + + ## [Sparc - R220] Sun Solaris (5.8) + ## not sure whether this locale dir is correct Index: files/patch-ab =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-ab,v retrieving revision 1.5 diff -u -r1.5 patch-ab --- files/patch-ab 19 Oct 2002 22:14:38 -0000 1.5 +++ files/patch-ab 18 Dec 2002 01:49:03 -0000 @@ -1,5 +1,5 @@ ---- src/conf/upclient.conf.orig Thu Oct 10 04:36:24 2002 -+++ src/conf/upclient.conf Sat Oct 19 19:41:36 2002 +--- src/conf/upclient.conf.orig Sat Nov 30 03:27:16 2002 ++++ src/conf/upclient.conf Wed Dec 18 02:31:09 2002 @@ -9,7 +9,7 @@ AuthKey = <your_authkey> # Your Authorization key @@ -8,4 +8,13 @@ +Interval = 550 # Transmit interval UptimeServer = @UPTIMES_SERVER@ # Uptimes Project's data server - SendIdleTime = 1 # Send your idle time + SendIdle = 1 # Send CPU idle percent +@@ -20,7 +20,7 @@ + SendCPUDetail = 1 # (BSD, Linux, Solaris & Irix only) + # 0 = send generic CPU architecture + # 1 = send specific CPU model +-SendLoadAvg = 0 # Send 15-minute Load-average (unix only) (not implemented) ++SendLoadAvg = 1 # Send 15-minute Load-average (unix only) + + # Fill in if you're behind a proxy server. + #ProxyServer = <your.proxy.server.com> Index: files/patch-options.c =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-options.c,v retrieving revision 1.4 diff -u -r1.4 patch-options.c --- files/patch-options.c 19 Oct 2002 22:14:38 -0000 1.4 +++ files/patch-options.c 18 Dec 2002 01:48:00 -0000 @@ -1,11 +1,11 @@ ---- src/options.c.orig Wed Oct 2 06:50:49 2002 -+++ src/options.c Sat Oct 19 22:54:06 2002 -@@ -55,7 +55,7 @@ +--- src/options.c.orig Sat Nov 30 03:27:15 2002 ++++ src/options.c Wed Dec 18 01:43:00 2002 +@@ -60,7 +60,7 @@ + * Minimum value is enforced. A warning is logged if greater than upper limit. */ - char cfg_authkey[AUTHKEY_REQUIRED_LEN+1] = ""; - char cfg_upserver[UPSERVER_MAXLEN+1] = "uptimes.wonko.com"; --int cfg_interval = 300; -+int cfg_interval = 550; - char cfg_pidfile[PIDFILE_MAXLEN+1] = PIDFILE; - char cfg_proxyserver[PROXYSERVER_MAXLEN+1] = ""; - int cfg_udpport = 49153; + #define MINIMUM_INTERVAL 30 /* enforced */ +-#define DEFAULT_INTERVAL 300 ++#define DEFAULT_INTERVAL 550 + #define UPPER_INTERVAL 600 /* warning if exceeded */ + + /* Macros */ Index: files/patch-stats-bsd.c =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-stats-bsd.c,v retrieving revision 1.3 diff -u -r1.3 patch-stats-bsd.c --- files/patch-stats-bsd.c 19 Oct 2002 22:14:38 -0000 1.3 +++ files/patch-stats-bsd.c 18 Dec 2002 02:28:25 -0000 @@ -1,294 +1,143 @@ ---- src/stats-bsd.c.orig Mon Sep 30 02:58:36 2002 -+++ src/stats-bsd.c Sat Oct 19 22:50:30 2002 -@@ -41,139 +41,171 @@ - #include "upclient.h" - #include "options.h" - #include "stats.h" --#include "uplog.h" /* wrapper for <syslog.h> */ - - /* System includes */ --#include <kvm.h> --#include <stdio.h> -+#include <err.h> - #include <errno.h> - #include <fcntl.h> -+#include <kvm.h> - #include <limits.h> --#include <sys/time.h> --#include <sys/param.h> -+#include <stdio.h> -+#include <syslog.h> - #include <sys/dkstat.h> -+#include <sys/param.h> - #include <sys/sysctl.h> -+#include <sys/time.h> - #include <sys/utsname.h> +--- src/stats-bsd.c.orig Sat Nov 30 03:27:16 2002 ++++ src/stats-bsd.c Wed Dec 18 03:28:16 2002 +@@ -64,6 +64,8 @@ + #include "locale.h" /* gettext */ + ++void logcalc(char *, char *); ++ /** - * @desc Get statistics + * @desc Verbose level 2 logging of calulations */ --void getstats(unsigned long *puptime, double *pload, int *pidle, char *os, char *oslevel, char *cpu) { -- struct utsname uts; -- struct timeval boottime; -+void -+getstats(unsigned long *puptime, double *pload, int *pidle, -+ char *os, char *oslevel, char *cpu) -+{ -+ size_t size; -+ int mib[2]; -+ -+ { /* ========== uptime ========== */ -+ static struct timeval boottime; -+ static int initialized = 0; - time_t now; +@@ -81,12 +83,13 @@ + void + initCPU(char *cpu) + { +- char buf[CPU_SIZE] = ""; + static int initialized = 0; - size_t size; -- double loadavgs[2]; -- int mib[2]; -- -- /* Get uptime */ -- time(&now); -- mib[0] = CTL_KERN; -- mib[1] = KERN_BOOTTIME; -- size = sizeof(boottime); -- if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && (boottime.tv_sec != 0)) { -- *puptime = now - boottime.tv_sec; -- *puptime /= 60; -- } -- -- if (cfg_sendload) { -- /* Get load average */ -- getloadavg(loadavgs, 3); -- /* Use the 3rd element (15 minute load average) */ -- *pload = loadavgs[2]; -- } -- -- if (cfg_sendos) { -- /* Get os info */ -- uname(&uts); -- } -- -- if (cfg_sendcpu) { -- /* Get CPU info */ -- mib[0] = CTL_HW; -- if (cfg_sendcpulevel == 1) { -- mib[1] = HW_MACHINE; /* Send architecture */ -- } -- else { -- mib[1] = HW_MODEL; /* Send architecture's specific model */ -- } -- size = CPU_SIZE; -- sysctl(mib, 2, cpu, &size, NULL, 0); -- } -- -- if (cfg_sendos) { -- strncpy(os, uts.sysname, OS_SIZE - 1); -- if (cfg_sendoslevel) { -- strncpy(oslevel, uts.release, OSLEVEL_SIZE - 1); -- } -- } -- -- if (cfg_sendidle) { -- static kvm_t *kp; -- static int initialized = 0; -- static struct nlist namelist [] = { -+ -+ if (!initialized) { -+ initialized = 1; -+ -+ mib[0] = CTL_KERN; -+ mib[1] = KERN_BOOTTIME; -+ size = sizeof(boottime); -+ -+ if (sysctl(mib, 2, &boottime, &size, NULL, 0) == -1) { -+ uplog(LOG_ERR, "sysctl: kern.boottime"); -+ err(1, "sysctl: kern.boottime"); -+ } -+ } -+ -+ if (boottime.tv_sec) { -+ time_t now; -+ -+ time (&now); -+ -+ *puptime = now - boottime.tv_sec; -+ *puptime /= 60; -+ } -+ } -+ -+ if (cfg_sendload) { /* ========== loadavg ========== */ -+ double loadavgs[3] = { 0. }; -+ -+ getloadavg(loadavgs, 3); -+ /* Use the 3rd element (15 minute load average) */ -+ *pload = loadavgs[2]; -+ } -+ -+ if (cfg_sendcpu) { /* ========== cpu ========== */ -+ static char buf[CPU_SIZE] = ""; -+ static int initialized = 0; -+ -+ if (!initialized) { -+ initialized = 1; -+ -+ mib[0] = CTL_HW; -+ if (cfg_sendcpulevel == 1) -+ mib[1] = HW_MACHINE; /* Send architecture */ -+ else -+ mib[1] = HW_MODEL; /* Send architecture's specific model */ -+ size = CPU_SIZE; -+ -+ if (sysctl(mib, 2, buf, &size, NULL, 0) == -1) { -+ uplog(LOG_WARNING, "sysctl: hw.model"); -+ /* warn("sysctl: hw.model"); */ -+ } -+ } -+ -+ strlcpy(cpu, buf, CPU_SIZE); -+ } -+ -+ if (cfg_sendos) { -+ static struct utsname uts; -+ static int initialized = 0; -+ -+ if (!initialized) { -+ initialized = 1; -+ -+ uname(&uts); -+ } -+ -+ strlcpy(os, uts.sysname, OS_SIZE); -+ -+ if (cfg_sendoslevel) -+ strlcpy(oslevel, uts.release, OSLEVEL_SIZE); -+ } +- int mib[2]; + + if (!initialized) { ++ char buf[CPU_SIZE] = ""; ++ size_t size; ++ int mib[2]; + -+ if (cfg_sendidle) { /* ========== idle_time ========== */ -+ static kvm_t *kp; -+ static int initialized = 0; -+ static struct nlist namelist[] = { - #define X_CP_TIME 0 -- { "_cp_time" }, -- { NULL }, -- }; -- -- if (!initialized) { -- char errbuf[_POSIX2_LINE_MAX]; -- initialized = 1; -- -- setgid(getgid()); -- -- kp = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); -- -- if (!kp) { -- uplog(LOG_WARNING, "kvm_openfiles: %s. (Did you forget to start upclient as root?)", errbuf); --// warn("kvm_openfiles: %s", errbuf); -- } -- else if (kvm_nlist(kp,namelist) == -1) { -- uplog(LOG_WARNING, "kvm_nlist: %s", kvm_geterr(kp)); --// warn("kvm_nlist: %s", kvm_geterr(kp)); -- } -- } -- -- if (kp) { -- long ctime[CPUSTATES]; -- static long stime[CPUSTATES]; -- static int first_time = 1; -- -- if (first_time) { -- first_time = 0; -- -- if (kvm_read(kp, namelist[X_CP_TIME].n_value, stime, sizeof(stime)) == -1) { -- uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp)); --// warn("kvm_read: %s", kvm_geterr(kp)); -- } -- else -- sleep(1); /* to avoid the initial 0 idle value */ -- } -- -- if (kvm_read(kp, namelist[X_CP_TIME].n_value, ctime, sizeof(ctime)) == -1) { -- uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp)); --// warn("kvm_read: %s", kvm_geterr(kp)); -- } -- else { -- int state; -- double time = 0.; -- -- for(state = 0; state < CPUSTATES; state++) -- time += ctime[state] - stime[state]; -- -- if (time == 0.) -- time = 1.; -- -- *pidle = (ctime[CP_IDLE] - stime[CP_IDLE]) * 100. / time; + initialized = 1; + + mib[0] = CTL_HW; +@@ -98,7 +101,6 @@ + + if (sysctl(mib, 2, buf, &size, NULL, 0) == -1) { + uplog(LOG_WARNING, "sysctl: hw.model"); +- /* warn("sysctl: hw.model"); */ + } + strlcpy(cpu, buf, CPU_SIZE); + logcalc(_("CPU"), cpu); +@@ -154,7 +156,6 @@ + err(1, "sysctl: kern.boottime"); + } + boottimesecs = boottime.tv_sec; +- /* logcalc(_("boot time"), boottimesecs); */ + #if defined DEBUG + uplog(LOG_DEBUG, "initBoottime() initialized %d", boottimesecs); + #endif /* DEBUG */ +@@ -173,19 +174,18 @@ + _("%s %s not implemented for this operating system %s"), + _("WARNING:"), _("Load-average"), strerror(errno)); + cfg_SendUsage = 0; +- return; + } + else if (loads < 0) { + uplog(LOG_WARNING, _("%s Could not get load-average %s"), _("WARNING:"), + strerror(errno)); +- return; + } - -- for(state = 0; state < CPUSTATES; state++) -- stime[state] = ctime[state]; -- } -- } -- else { -- cfg_sendidle = 0; -- } -+ { "_cp_time" }, -+ { NULL }, -+ }; -+ -+ if (!initialized) { -+ char errbuf[_POSIX2_LINE_MAX]; -+ initialized = 1; -+ -+ setgid(getgid()); -+ -+ kp = kvm_openfiles(NULL,NULL,NULL,O_RDONLY,errbuf); -+ -+ if (!kp) { -+ uplog(LOG_WARNING, "kvm_openfiles: %s",errbuf); -+ /* warn("kvm_openfiles: %s",errbuf); */ -+ } else if (kvm_nlist(kp,namelist) == -1) { -+ uplog(LOG_WARNING, "kvm_nlist: %s",kvm_geterr(kp)); -+ /* warn("kvm_nlist: %s",kvm_geterr(kp)); */ -+ } +- /* Use the 3rd element (15 minute Load-average) */ +- *loadavg = loadavgs[2]; ++ else { ++ /* Use the 3rd element (15 minute Load-average) */ ++ *loadavg = loadavgs[2]; + #if defined DEBUG +- uplog(LOG_DEBUG, "getLoadavg() %.2f", *loadavg); ++ uplog(LOG_DEBUG, "getLoadavg() %.2f", *loadavg); + #endif /* DEBUG */ + } -+ -+ if (kp) { -+ long ctime[CPUSTATES]; -+ static long stime[CPUSTATES]; -+ static int first_time = 1; -+ -+ if (first_time) { -+ first_time = 0; -+ -+ if (kvm_read(kp, namelist[X_CP_TIME].n_value, -+ stime, sizeof(stime)) == -1) { -+ uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp)); -+ /* warn("kvm_read: %s", kvm_geterr(kp)); */ -+ } else -+ sleep(1); /* to avoid the initial 0 idle value */ -+ } -+ -+ if (kvm_read(kp, namelist[X_CP_TIME].n_value, -+ ctime, sizeof(ctime)) == -1) { -+ uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp)); -+ /* warn("kvm_read: %s", kvm_geterr(kp)); */ -+ } else { -+ int state; -+ double time = 0.; -+ -+ for (state = 0; state < CPUSTATES; state++) -+ time += ctime[state] - stime[state]; -+ -+ if (time == 0.) -+ time = 1.; -+ -+ *pidle = (ctime[CP_IDLE] - stime[CP_IDLE]) * 100. / time; -+ -+ for (state = 0; state < CPUSTATES; state++) -+ stime[state] = ctime[state]; -+ } -+ } else { -+ cfg_sendidle = 0; + } + + #if !defined __MACH__ /* Mach kernel stuff is in stats-mach.c */ +@@ -245,7 +245,7 @@ + + for (state = 0; state < CPUSTATES; state++) { + time += ctime[state] - stime[state]; +- if (!(state == CPU_STATE_IDLE)) { ++ if (!(state == CP_IDLE)) { + nonidlecpu += (float)(ctime[state] - stime[state]); + } + } +@@ -258,6 +258,10 @@ + + for (state = 0; state < CPUSTATES; state++) + stime[state] = ctime[state]; ++#if defined DEBUG ++ uplog(LOG_DEBUG, "getLoadIdle() load=%.1f idle=%.1f", *UsagePercent, ++ *IdlePercent); ++#endif /* DEBUG */ + } } -+ } + else { +@@ -268,17 +272,13 @@ + cfg_SendUsage = 0; + cfg_SendIdle = 0; + } +-#if defined DEBUG +- uplog(LOG_DEBUG, "getLoadIdle() load=%.1f idle=%.1f", *UsagePercent, +- *IdlePercent); +-#endif /* DEBUG */ } --#endif /* PLATFORM_BSD */ -+ -+#endif /* PLATFORM_BSD */ + #endif /* !__MACH__ */ + + void + getUptime(unsigned long *uptimeminutes) + { +- static time_t boottimesecs; ++ time_t boottimesecs; + + boottimesecs = initBoottime(); + +@@ -293,7 +293,7 @@ + #endif /* DEBUG */ + } + else { +- uplog(LOG_INFO, _("%s: %s failed"), _("ERROR:"), ++ uplog(LOG_ERR, _("%s %s failed"), _("ERROR:"), + "getUptime() boottime.tv_sec"); + } + } +@@ -306,19 +306,18 @@ + double *IdlePercent, char *osname, char *osversion, char *cpu, + double *loadavg) + { +- getUptime(&*uptimeminutes); ++ getUptime(uptimeminutes); + + if (cfg_SendUsage || cfg_SendIdle) +- getLoadIdle(&*UsagePercent, &*IdlePercent); ++ getLoadIdle(UsagePercent, IdlePercent); + + if (cfg_sendosname || cfg_sendosversion) +- initOS(&*osname, &*osversion); ++ initOS(osname, osversion); + + if (cfg_sendcpu) +- initCPU(&*cpu); +- +- /* if (cfg_sendloadavg) */ +- getLoadavg(&*loadavg); ++ initCPU(cpu); + ++ if (cfg_sendloadavg) ++ getLoadavg(loadavg); + } + #endif /* PLATFORM_BSD */ Index: files/patch-upchk =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-upchk,v retrieving revision 1.3 diff -u -r1.3 patch-upchk --- files/patch-upchk 19 Oct 2002 22:14:38 -0000 1.3 +++ files/patch-upchk 18 Dec 2002 01:46:49 -0000 @@ -1,5 +1,5 @@ --- scripts/upchk.orig Mon Sep 23 19:28:31 2002 -+++ scripts/upchk Sat Oct 19 22:52:27 2002 ++++ scripts/upchk Wed Dec 18 02:40:31 2002 @@ -24,7 +24,7 @@ # Index: files/upclient.sh =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/upclient.sh,v retrieving revision 1.2 diff -u -r1.2 upclient.sh --- files/upclient.sh 19 Nov 2001 06:38:34 -0000 1.2 +++ files/upclient.sh 18 Dec 2002 02:39:34 -0000 @@ -22,6 +22,8 @@ config_file=${program_file}.conf config_path=${config_dir}/${config_file} +sample_path=${config_path}.sample + pid_dir=/var/run pid_file=${program_file}.pid pid_path=${pid_dir}/${pid_file} @@ -54,7 +56,15 @@ "${config_path}." exit 72 fi - ${program_path} && + kw="IdleTime|OS|(OS|CPU)Level" + if egrep -qs "^[$ws]*Send($kw)[$ws]*=" ${config_path} + then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: ${config_path} needs to be updated" \ + "from ${sample_path}." + exit 72 + fi + ${program_path} 2> /dev/null && echo -n " ${program_file}" ;; stop) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212180256.gBI2uDqw027876>