mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-23 04:23:08 +00:00
Update to 5.0.b6.
PR: 46339 Submitted by: maintainer
This commit is contained in:
parent
153627559c
commit
c547be44da
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=72346
@ -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 @@ MAINTAINER= cyrille.lefevre@laposte.net
|
||||
# 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 @@ MAN8= upclient.8
|
||||
#
|
||||
|
||||
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 @@ post-patch: patch-prefix patch-pkgmessage
|
||||
|
||||
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 @@ patch-pkgmessage:
|
||||
# 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 @@ install-sample:
|
||||
${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
|
||||
#
|
||||
|
@ -1 +1 @@
|
||||
MD5 (upclient-5.0b5.tar.gz) = fa6a74f146eacf47f4b0773a835a570e
|
||||
MD5 (upclient-5.0b6.tar.gz) = 3d4c45addb947a51deabf2205188b82e
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
20
misc/upclient/files/patch-clientchk
Normal file
20
misc/upclient/files/patch-clientchk
Normal file
@ -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.
|
@ -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 */
|
||||
|
@ -1,14 +0,0 @@
|
||||
--- src/options.h.orig Mon Sep 30 02:58:36 2002
|
||||
+++ src/options.h Sat Oct 19 22:55:19 2002
|
||||
@@ -60,11 +60,7 @@
|
||||
extern char cfg_proxyuser[PROXYUSER_MAXLEN+1];
|
||||
extern char cfg_proxypass[PROXYPASS_MAXLEN+1];
|
||||
extern int cfg_sendidle;
|
||||
-#if defined(PLATFORM_UNIXWARE)
|
||||
extern int cfg_sendload;
|
||||
-#else
|
||||
-extern int cfg_sendload;
|
||||
-#endif
|
||||
extern int cfg_sendos;
|
||||
extern int cfg_sendoslevel;
|
||||
extern int cfg_sendcpu;
|
@ -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> */
|
||||
--- 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 @@
|
||||
|
||||
/* 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>
|
||||
#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 [] = {
|
||||
- int mib[2];
|
||||
|
||||
if (!initialized) {
|
||||
+ char buf[CPU_SIZE] = "";
|
||||
+ size_t size;
|
||||
+ int mib[2];
|
||||
+
|
||||
+ 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);
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
-
|
||||
- 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)); */
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
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;
|
||||
}
|
||||
-
|
||||
- /* 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 */
|
||||
+ }
|
||||
}
|
||||
-#endif /* PLATFORM_BSD */
|
||||
+
|
||||
+#endif /* PLATFORM_BSD */
|
||||
|
||||
#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 /* !__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 */
|
||||
|
12
misc/upclient/files/patch-transmit.c
Normal file
12
misc/upclient/files/patch-transmit.c
Normal file
@ -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
|
@ -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 @@
|
||||
#
|
||||
|
||||
|
@ -22,6 +22,8 @@ config_dir=${PREFIX}/etc
|
||||
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 @@ start)
|
||||
"${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)
|
||||
|
@ -3,6 +3,7 @@ etc/rc.d/upclient.sh
|
||||
@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
|
||||
%%PORTDOCS%%share/doc/upclient/AUTHORS
|
||||
@ -13,4 +14,7 @@ sbin/upclient
|
||||
%%PORTDOCS%%share/doc/upclient/INSTALL
|
||||
%%PORTDOCS%%share/doc/upclient/README
|
||||
%%PORTDOCS%%share/doc/upclient/TODO
|
||||
%%PORTDOCS%%share/doc/upclient/UptimesProtocol5
|
||||
share/locale/de/LC_MESSAGES/upclient.mo
|
||||
share/locale/fr/LC_MESSAGES/upclient.mo
|
||||
%%PORTDOCS%%@dirrm share/doc/upclient
|
||||
|
Loading…
Reference in New Issue
Block a user