From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Jul 31 14:10:19 2003 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 8BE5037B401 for ; Thu, 31 Jul 2003 14:10:19 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9137143FBD for ; Thu, 31 Jul 2003 14:10:17 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h6VLAHUp016274 for ; Thu, 31 Jul 2003 14:10:17 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h6VLAHw7016273; Thu, 31 Jul 2003 14:10:17 -0700 (PDT) Resent-Date: Thu, 31 Jul 2003 14:10:17 -0700 (PDT) Resent-Message-Id: <200307312110.h6VLAHw7016273@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, Thorsten Greiner Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 376AA37B401 for ; Thu, 31 Jul 2003 14:08:51 -0700 (PDT) Received: from smtp.web.de (smtp03.web.de [217.72.192.158]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6568343FCB for ; Thu, 31 Jul 2003 14:08:50 -0700 (PDT) (envelope-from thorsten.greiner@web.de) Received: from [80.141.9.22] (helo=tybalt) by smtp.web.de with asmtp (WEB.DE 4.99 #433) id 19iKfI-0000H0-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 31 Jul 2003 23:08:48 +0200 Message-Id: <20030731210848.GA9623@tybalt> Date: Thu, 31 Jul 2003 23:08:48 +0200 From: Thorsten Greiner Sender: thorsten.greiner@web.de To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/55133: New port: sysutils/xfce4-systemload-plugin X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2003 21:10:20 -0000 >Number: 55133 >Category: ports >Synopsis: New port: sysutils/xfce4-systemload-plugin >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Jul 31 14:10:17 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Thorsten Greiner >Release: FreeBSD 5.1-CURRENT i386 >Organization: n/a >Environment: System: FreeBSD tybalt 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Wed Jul 30 21:02:42 CEST 2003 root@tybalt:/usr/src/sys/i386/compile/TYBALT i386 >Description: System Load plugin for XFce4 >How-To-Repeat: n/a >Fix: Unpack the shar archive # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # xfce4-systemload-plugin # xfce4-systemload-plugin/Makefile # xfce4-systemload-plugin/files # xfce4-systemload-plugin/files/patch-memswap.c # xfce4-systemload-plugin/distinfo # xfce4-systemload-plugin/pkg-plist # xfce4-systemload-plugin/pkg-descr # echo c - xfce4-systemload-plugin mkdir -p xfce4-systemload-plugin > /dev/null 2>&1 echo x - xfce4-systemload-plugin/Makefile sed 's/^X//' >xfce4-systemload-plugin/Makefile << 'END-of-xfce4-systemload-plugin/Makefile' X# New ports collection makefile for: xfce-systemload-plugin X# Date created: 31 June 2003 X# Whom: Thorsten Greiner X# X# $FreeBSD$ X# X XPORTNAME= xfce4-systemload-plugin XPORTVERSION= 0.3.2 XCATEGORIES= sysutils XMASTER_SITES= http://download.berlios.de/xfce-goodies/ XDISTNAME= xfce4-systemload-plugin-${PORTVERSION} XDIST_SUBDIR= xfce4 X XMAINTAINER= ports@FreeBSD.org XCOMMENT= System Load plugin for XFce4 X XBUILD_DEPENDS= xfce4-panel:${PORTSDIR}/x11-wm/xfce4-panel XLIB_DEPENDS= xfce4util:${PORTSDIR}/x11/libxfce4util X XUSE_GNOME= gtk20 XUSE_X_PREFIX= yes XGNU_CONFIGURE= yes XCONFIGURE_TARGET= --build=${ARCH}-portbld-freebsd${OSREL} X X.include END-of-xfce4-systemload-plugin/Makefile echo c - xfce4-systemload-plugin/files mkdir -p xfce4-systemload-plugin/files > /dev/null 2>&1 echo x - xfce4-systemload-plugin/files/patch-memswap.c sed 's/^X//' >xfce4-systemload-plugin/files/patch-memswap.c << 'END-of-xfce4-systemload-plugin/files/patch-memswap.c' X--- panel-plugin/memswap.c.orig Tue Jul 29 21:40:55 2003 X+++ panel-plugin/memswap.c Thu Jul 31 22:43:10 2003 X@@ -193,4 +193,113 @@ X X return 0; X } X-#endif X\ No newline at end of file X+#endif X+ X+#if defined(__FreeBSD__) X+/* X+ * This is inspired by /usr/src/usr.bin/top/machine.c X+ * X+ * Adapted by Thorsten Greiner X+ * X+ * Original authors: Christos Zoulas X+ * Steven Wallace X+ * Wolfram Schneider X+ * Thomas Moestl X+ */ X+ X+#include X+#include X+#include X+ X+#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var)) X+ X+static int getsysctl (char *name, void *ptr, size_t len) X+{ X+ size_t nlen = len; X+ if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) { X+ return -1; X+ } X+ if (nlen != len) { X+ return -1; X+ } X+ return 0; X+} X+ X+static kvm_t *kd = NULL; X+ X+static int swapmode(int *retavail, int *retfree) X+{ X+ int n; X+ int pagesize = getpagesize(); X+ struct kvm_swap swapary[1]; X+ static int kd_init = TRUE; X+ X+ if(kd_init) { X+ kd_init = FALSE; X+ if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null", X+ O_RDONLY, "kvm_open")) == NULL) { X+ g_warning("Cannot read kvm."); X+ return -1; X+ } X+ } X+ if(kd == NULL) { X+ return -1; X+ } X+ X+ *retavail = 0; X+ *retfree = 0; X+ X+#define CONVERT(v) ((quad_t)(v) * pagesize / 1024) X+ X+ n = kvm_getswapinfo(kd, swapary, 1, 0); X+ if (n < 0 || swapary[0].ksw_total == 0) X+ return(0); X+ X+ *retavail = CONVERT(swapary[0].ksw_total); X+ *retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used); X+ X+ n = (int)((double)swapary[0].ksw_used * 100.0 / X+ (double)swapary[0].ksw_total); X+ return(n); X+} X+ X+gint read_memswap(gulong *mem, gulong *swap, gulong *MT, gulong *MU, gulong *ST, gulong *SU) X+{ X+ int total_pages; X+ int free_pages; X+ int inactive_pages; X+ int pagesize = getpagesize(); X+ int swap_avail; X+ int swap_free; X+ X+ if(GETSYSCTL("vm.stats.vm.v_page_count", total_pages)) { X+ g_warning("Cannot read sysctl \"vm.stats.vm.v_page_count\""); X+ return -1; X+ } X+ if(GETSYSCTL("vm.stats.vm.v_free_count", free_pages)) { X+ g_warning("Cannot read sysctl \"vm.stats.vm.v_free_count\""); X+ return -1; X+ } X+ if(GETSYSCTL("vm.stats.vm.v_inactive_count", inactive_pages)) { X+ g_warning("Cannot read sysctl \"vm.stats.vm.v_inactive_count\""); X+ return -1; X+ } X+ X+ *MT = (total_pages*pagesize) >> 10; X+ *MU = ((total_pages-free_pages-inactive_pages) * pagesize) >> 10; X+ *mem = *MU * 100 / *MT; X+ X+ if((*swap = swapmode(&swap_avail, &swap_free)) >= 0) { X+ *ST = swap_avail; X+ *SU = (swap_avail - swap_free); X+ } X+ else { X+ *swap = 0; X+ *ST = 0; X+ *SU = 0; X+ } X+ X+ return 0; X+} X+ X+#endif /* defined(__FREEBSD) */ END-of-xfce4-systemload-plugin/files/patch-memswap.c echo x - xfce4-systemload-plugin/distinfo sed 's/^X//' >xfce4-systemload-plugin/distinfo << 'END-of-xfce4-systemload-plugin/distinfo' XMD5 (xfce4/xfce4-systemload-plugin-0.3.2.tar.gz) = 54f940ea77261bb61ca54dd77253c222 END-of-xfce4-systemload-plugin/distinfo echo x - xfce4-systemload-plugin/pkg-plist sed 's/^X//' >xfce4-systemload-plugin/pkg-plist << 'END-of-xfce4-systemload-plugin/pkg-plist' Xlib/xfce4/panel-plugins/libsystemload.a Xlib/xfce4/panel-plugins/libsystemload.la Xlib/xfce4/panel-plugins/libsystemload.so X@unexec rmdir %D/lib/xfce4/panel-plugins 2>/dev/null || true X@unexec rmdir %D/lib/xfce4 2>/dev/null || true END-of-xfce4-systemload-plugin/pkg-plist echo x - xfce4-systemload-plugin/pkg-descr sed 's/^X//' >xfce4-systemload-plugin/pkg-descr << 'END-of-xfce4-systemload-plugin/pkg-descr' XSystem Load plugin for XFce4. X XWWW: http://www.xfce.org END-of-xfce4-systemload-plugin/pkg-descr exit >Release-Note: >Audit-Trail: >Unformatted: