From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Dec 23 15:40:20 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 376AB16A4CF for ; Thu, 23 Dec 2004 15:40:20 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAF8E43D3F for ; Thu, 23 Dec 2004 15:40:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iBNFeJEB010444 for ; Thu, 23 Dec 2004 15:40:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iBNFeJ8e010442; Thu, 23 Dec 2004 15:40:19 GMT (envelope-from gnats) Resent-Date: Thu, 23 Dec 2004 15:40:19 GMT Resent-Message-Id: <200412231540.iBNFeJ8e010442@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Roman Bogorodskiy Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CFAAF16A4CE for ; Thu, 23 Dec 2004 15:31:02 +0000 (GMT) Received: from mx2.mail.ru (mx2.mail.ru [194.67.23.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDAA943D31 for ; Thu, 23 Dec 2004 15:31:01 +0000 (GMT) (envelope-from bogorodskiy@inbox.ru) Received: from [194.186.150.39] (port=55055 helo=novel.zapto.org) by mx2.mail.ru with esmtp id 1ChUvX-000OCC-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 23 Dec 2004 18:30:56 +0300 Message-Id: Date: Thu, 23 Dec 2004 18:30:56 +0300 From: Roman Bogorodskiy To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/75435: [ maintainer ] sysutils/torsmo: update to 0.18 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Roman Bogorodskiy List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Dec 2004 15:40:20 -0000 >Number: 75435 >Category: ports >Synopsis: [ maintainer ] sysutils/torsmo: update to 0.18 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Thu Dec 23 15:40:19 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Roman Bogorodskiy >Release: FreeBSD 5.3-RELEASE-p2 i386 >Organization: >Environment: System: FreeBSD lame.novel.ru 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #3: Sat Dec 11 21:01:26 MSK 2004 root@lame.novel.ru:/usr/obj/usr/src/sys/MIRRORBOX i386 >Description: Update to 0.18 >How-To-Repeat: >Fix: --- port.torsmo.update begins here --- diff -ruN torsmo.orig/Makefile torsmo/Makefile --- torsmo.orig/Makefile Wed Dec 22 20:47:00 2004 +++ torsmo/Makefile Wed Dec 22 21:38:29 2004 @@ -6,8 +6,7 @@ # PORTNAME= torsmo -PORTVERSION= 0.17 -PORTREVISION= 2 +PORTVERSION= 0.18 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} @@ -15,8 +14,7 @@ MAINTAINER= bogorodskiy@inbox.ru COMMENT= System monitor that renders text on desktop -USE_AUTOCONF_VER=259 -USE_AUTOMAKE_VER=14 +GNU_CONFIGURE= yes USE_X_PREFIX= yes MAN1= torsmo.1 @@ -26,9 +24,6 @@ PORTDOCS= AUTHORS ChangeLog NEWS README .include - -post-extract: - @${CP} ${FILESDIR}/freebsd.c ${WRKSRC} post-install: .if !defined(NOPORTDOCS) diff -ruN torsmo.orig/distinfo torsmo/distinfo --- torsmo.orig/distinfo Wed Dec 22 20:47:00 2004 +++ torsmo/distinfo Wed Dec 22 20:48:45 2004 @@ -1,2 +1,2 @@ -MD5 (torsmo-0.17.tar.gz) = 8c82134cd78f9d4a7b6f6721ee2c16f9 -SIZE (torsmo-0.17.tar.gz) = 80286 +MD5 (torsmo-0.18.tar.gz) = 88bd8f627637d785a1d681f4f15f00b6 +SIZE (torsmo-0.18.tar.gz) = 84020 Binary files torsmo.orig/files/.patch-torsmo.c.swp and torsmo/files/.patch-torsmo.c.swp differ diff -ruN torsmo.orig/files/freebsd.c torsmo/files/freebsd.c --- torsmo.orig/files/freebsd.c Wed Dec 22 20:47:00 2004 +++ torsmo/files/freebsd.c Thu Jan 1 03:00:00 1970 @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2004 Roman Bogorodskiy - * - * $FreeBSD: ports/sysutils/torsmo/files/freebsd.c,v 1.6 2004/10/25 21:42:01 pav Exp $ - */ - -#include "torsmo.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var)) -#define KELVTOC(x) ((x - 2732) / 10.0) - -static int getsysctl(char *name, void *ptr, size_t len) -{ - size_t nlen = len; - if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) { - return -1; - } - - if (nlen != len) { - return -1; - } - - return 0; -} - -static kvm_t *kd = NULL; -struct ifmibdata *data = NULL; -size_t len = 0; - -static int swapmode(int *retavail, int *retfree) -{ - int n; - int pagesize = getpagesize(); - struct kvm_swap swapary[1]; - static int kd_init = 1; - - if(kd_init) { - kd_init = 0; - if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null", - O_RDONLY, "kvm_open")) == NULL) { - (void)fprintf(stderr, "Cannot read kvm\n"); - return -1; - } - } - - if(kd == NULL) { - return -1; - } - - *retavail = 0; - *retfree = 0; - -#define CONVERT(v) ((quad_t)(v) * pagesize / 1024) - - n = kvm_getswapinfo(kd, swapary, 1, 0); - if (n < 0 || swapary[0].ksw_total == 0) - return(0); - - *retavail = CONVERT(swapary[0].ksw_total); - *retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used); - - n = (int)((double)swapary[0].ksw_used * 100.0 / - (double)swapary[0].ksw_total); - - return n; -} - - -void prepare_update() { -} - -double get_uptime() -{ - int mib[2] = {CTL_KERN, KERN_BOOTTIME}; - struct timeval boottime; - time_t now; - size_t size = sizeof(boottime); - double uptime; - - if((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1) && (boottime.tv_sec != 0)) { - time(&now); - uptime = now - boottime.tv_sec; - } else { - (void)fprintf(stderr, "Could not get uptime\n"); - uptime = 0; - } - - return uptime; -} - - -void update_meminfo() { - int total_pages, - inactive_pages, - free_pages; - int swap_avail, - swap_free; - - int pagesize = getpagesize(); - - if (GETSYSCTL("vm.stats.vm.v_page_count", total_pages)) - (void)fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_page_count\"\n"); - - if (GETSYSCTL("vm.stats.vm.v_free_count", free_pages)) - (void)fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_free_count\"\n"); - - if (GETSYSCTL("vm.stats.vm.v_inactive_count", inactive_pages)) - (void)fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_inactive_count\"\n"); - - memmax = (total_pages*pagesize) >> 10; - mem = ((total_pages-free_pages-inactive_pages) * pagesize) >> 10; - - - if ((swapmode(&swap_avail, &swap_free)) >= 0) { - swapmax = swap_avail; - swap = (swap_avail - swap_free); - } else { - swapmax = 0; - swap = 0; - } -} - -void update_net_stats() { - struct net_stat *ns; - double delta; - long long r, t, last_recv, last_trans; - struct ifaddrs *ifap, *ifa; - struct if_data *ifd; - - - /* get delta */ - delta = current_update_time - last_update_time; - if (delta <= 0.0001) - return; - - if (getifaddrs(&ifap) < 0) - return; - - for (ifa = ifap; ifa; ifa = ifa->ifa_next) { - ns = get_net_stat((const char *)ifa->ifa_name); - - if (ifa->ifa_flags & IFF_UP) { - last_recv = ns->recv; - last_trans = ns->trans; - - if (ifa->ifa_addr->sa_family != AF_LINK) - continue; - - ifd = (struct if_data *)ifa->ifa_data; - r = ifd->ifi_ibytes; - t = ifd->ifi_obytes; - - if (r < ns->last_read_recv) - ns->recv += ((long long) 4294967295U - ns->last_read_recv) + r; - else - ns->recv += (r - ns->last_read_recv); - - ns->last_read_recv = r; - - if (t < ns->last_read_trans) - ns->trans += ((long long) 4294967295U - ns->last_read_trans) + t; - else - ns->trans += (t - ns->last_read_trans); - - ns->last_read_trans = t; - - - /* calculate speeds */ - ns->recv_speed = (ns->recv - last_recv) / delta; - ns->trans_speed = (ns->trans - last_trans) / delta; - } - } - - freeifaddrs(ifap); -} - - -int get_total_processes() { - /* It's easier to use kvm here than sysctl */ - - int n_processes; - static int kd_init = 1; - - if (kd_init) { - kd_init = 0; - if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null", - O_RDONLY, "kvm_open")) == NULL) { - (void)fprintf(stderr, "Cannot read kvm\n"); - return 0; - } - } - - - if (kd != NULL) - kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes); - else - return 0; - - return n_processes; -} - -int get_running_processes() { - static int kd_init = 1; - struct kinfo_proc *p; - int n_processes; - int i, - cnt = 0; - - if(kd_init) { - kd_init = 0; - if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null", O_RDONLY, "kvm_open")) == NULL) { - (void)fprintf(stderr, "Cannot read kvm\n"); - return 0; - } - } - - if (kd != NULL) { - p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes); - for (i = 0; i + #include + #include +-#include +-#include + #include + #include +-#include +-#include + #include + #include ++#include ++#include + #include + #include + #include +@@ -19,11 +17,48 @@ + #include + #include + #include ++#include + #include + + #define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var)) + #define KELVTOC(x) ((x - 2732) / 10.0) + ++static unsigned int get_timer(); ++static unsigned int get_cpu_speed(void); ++static inline unsigned long long int rdtsc( void ); ++ ++/* cpu frequency detection code based on mplayer's one */ ++ ++static unsigned int get_timer() { ++ struct timeval tv; ++ struct timezone tz; ++ gettimeofday(&tv,&tz); ++ ++ return (tv.tv_sec*1000000+tv.tv_usec); ++} ++ ++static inline unsigned long long int rdtsc( void ) ++{ ++ unsigned long long int retval; ++ __asm __volatile ("rdtsc":"=A"(retval)::"memory"); ++ return retval; ++} ++ ++static unsigned int get_cpu_speed(void) ++{ ++ unsigned long long int tscstart, tscstop; ++ unsigned int start, stop; ++ ++ tscstart = rdtsc(); ++ start = get_timer(); ++ usleep(50000); ++ stop = get_timer(); ++ tscstop = rdtsc(); ++ ++ return((tscstop-tscstart)/((stop-start)/1000.0)); ++} ++ ++ + static int getsysctl(char *name, void *ptr, size_t len) + { + size_t nlen = len; +@@ -344,4 +379,34 @@ + + char* get_acpi_fan() { + return ""; ++} ++ ++char* get_adt746x_cpu() { ++ return ""; ++} ++ ++char* get_adt746x_fan() { ++ return ""; ++} ++ ++char* get_freq() { ++ int i; ++ char *cpuspeed; ++ ++ if ((cpuspeed = (char *)malloc(16)) == NULL) ++ exit(1); ++ ++ i = 0; ++ if ((i = get_cpu_speed()) > 0) { ++ if (i < 1000000) { ++ i += 50; /* for rounding */ ++ snprintf(cpuspeed, 15, "%d.%d MHz", i/1000, (i/100)%10); ++ } else { ++ snprintf(cpuspeed, 15, "%d MHz", i/1000); ++ } ++ } else { ++ cpuspeed = ""; ++ } ++ ++ return cpuspeed; + } diff -ruN torsmo.orig/files/patch-fs.c torsmo/files/patch-fs.c --- torsmo.orig/files/patch-fs.c Wed Dec 22 20:47:00 2004 +++ torsmo/files/patch-fs.c Thu Jan 1 03:00:00 1970 @@ -1,37 +0,0 @@ ---- fs.c.orig Thu Aug 5 19:59:50 2004 -+++ fs.c Thu Aug 5 20:01:50 2004 -@@ -3,10 +3,12 @@ - #include - #include - #include --#include - #include - #include - -+#include -+#include -+ - /* TODO: benchmark which is faster, fstatvfs() or pre-opened fd and - * statvfs() (fstatvfs() would handle mounts I think...) */ - -@@ -15,16 +17,16 @@ - - void update_fs_stats() { - unsigned int i; -- struct statvfs s; -+ struct statfs s; - for (i=0; i<16; i++) { - if (fs_stats[i].fd <= 0) - break; - -- fstatvfs(fs_stats[i].fd, &s); -+ fstatfs(fs_stats[i].fd, &s); - -- fs_stats[i].size = (long long) s.f_blocks * s.f_frsize; -+ 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_frsize; -+ fs_stats[i].avail = (long long) s.f_bavail * s.f_bsize; - } - } - diff -ruN torsmo.orig/files/patch-torsmo.c torsmo/files/patch-torsmo.c --- torsmo.orig/files/patch-torsmo.c Wed Dec 22 20:47:00 2004 +++ torsmo/files/patch-torsmo.c Wed Dec 22 21:49:43 2004 @@ -1,6 +1,6 @@ ---- torsmo.c.orig Wed Oct 13 17:31:57 2004 -+++ torsmo.c Wed Oct 13 17:35:45 2004 -@@ -376,7 +376,7 @@ +--- torsmo.c.orig Wed Dec 22 01:14:46 2004 ++++ torsmo.c Wed Dec 22 21:49:27 2004 +@@ -272,7 +272,7 @@ snprintf(buf, 255, "%.1fM", m); } else if (a >= 1024) @@ -9,33 +9,33 @@ else snprintf(buf, 255, "%Ld", a); } -@@ -998,7 +998,7 @@ +@@ -883,7 +883,7 @@ } OBJ(acpitemp) { /* does anyone have decimals in acpi temperature? */ - snprintf(p, n, "%d", (int) get_acpi_temperature(obj->data.i)); + snprintf(p, n, "%0.1f", (float)get_acpi_temperature(obj->data.i)); } - OBJ(acpifan) { - snprintf(p, n, "%s", get_acpi_fan()); -@@ -2248,8 +2248,8 @@ + OBJ(freq) { + snprintf(p, n, "%s", get_freq()); +@@ -2223,8 +2223,8 @@ /* handle other command line arguments */ - optind = 0; - -+ optind = optreset = 1; ++ optind = optreset = 1; + while (1) { int c = getopt(argc, argv, getopt_string); if(c == -1) break; -@@ -2353,8 +2353,7 @@ +@@ -2319,8 +2319,7 @@ default: fprintf(stderr, "torsmo: forked to background, pid is %d\n", ret); - exit(0); - break; -+ return 0; ++ return 0; } } --- port.torsmo.update ends here --- >Release-Note: >Audit-Trail: >Unformatted: