diff --git a/sysutils/bubblemon-dockapp/Makefile b/sysutils/bubblemon-dockapp/Makefile new file mode 100644 index 00000000000..0111ee66fbf --- /dev/null +++ b/sysutils/bubblemon-dockapp/Makefile @@ -0,0 +1,34 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2001/08/28 14:24:28 wilfried Exp $ + +COMMENT= 'wm-dockapp; display CPU and memory load' + +DISTNAME= bubblemon-dockapp-1.32 +CATEGORIES= sysutils x11 x11/windowmaker +NEED_VERSION= 1.448 + +HOMEPAGE= http://www.ne.jp/asahi/linux/timecop/ + +MAINTAINER= Peter Stromberg + +# GPL +PERMIT_PACKAGE_CDROM= Yes +PERMIT_PACKAGE_FTP= Yes +PERMIT_DISTFILES_CDROM= Yes +PERMIT_DISTFILES_FTP= Yes + +MASTER_SITES= ${HOMEPAGE}software/ + +LIB_DEPENDS= gtk.1.2::x11/gtk+ + +USE_X11= Yes +USE_GMAKE= Yes + +post-patch: + cp files/sys_openbsd.c ${WRKSRC} + +do-install: + ${INSTALL_PROGRAM} $(WRKBUILD)/bubblemon ${PREFIX}/bin + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/bubblemon/ + ${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/bubblemon/ + +.include diff --git a/sysutils/bubblemon-dockapp/files/md5 b/sysutils/bubblemon-dockapp/files/md5 new file mode 100644 index 00000000000..2d6f1cc594f --- /dev/null +++ b/sysutils/bubblemon-dockapp/files/md5 @@ -0,0 +1,3 @@ +MD5 (bubblemon-dockapp-1.32.tar.gz) = d3ede4371c673bc155a11cf1ab791d9e +RMD160 (bubblemon-dockapp-1.32.tar.gz) = 9928a3e059d0f9e045f4b8f36ff201519eb41b93 +SHA1 (bubblemon-dockapp-1.32.tar.gz) = 687537036848a877d888fed15588ead239ad4f78 diff --git a/sysutils/bubblemon-dockapp/files/sys_openbsd.c b/sysutils/bubblemon-dockapp/files/sys_openbsd.c new file mode 100644 index 00000000000..a07ee7269ee --- /dev/null +++ b/sysutils/bubblemon-dockapp/files/sys_openbsd.c @@ -0,0 +1,130 @@ +/* BubbleMon dockapp 1.2 - OpenBSD specific code + * Copyright (C) 2001, Peter Stromberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "include/bubblemon.h" +#include "include/sys_include.h" + +extern BubbleMonData bm; + +/* Returns the current CPU load in percent */ +int system_cpu(void) +{ + int loadPercentage; + int previous_total, previous_load; + int total, load; + long cpu_time[CPUSTATES]; + int i; + + int mib[2]; + size_t size; + + mib[0] = CTL_KERN; + mib[1] = KERN_CPTIME; + size = sizeof (cpu_time); + + if (sysctl(mib, 2, &cpu_time, &size, NULL, 0) < 0) + return 0; + + load = cpu_time[CP_USER] + cpu_time[CP_SYS] + cpu_time[CP_NICE]; + total = load + cpu_time[CP_IDLE]; + + i = bm.loadIndex; + previous_load = bm.load[i]; + previous_total = bm.total[i]; + + bm.load[i] = load; + bm.total[i] = total; + bm.loadIndex = (i + 1) % bm.samples; + + if (previous_total == 0) + loadPercentage = 0; /* first time here */ + else if (total == previous_total) + loadPercentage = 100; + else + loadPercentage = (100 * (load - previous_load)) / (total - previous_total); + + return loadPercentage; +} + +int system_memory(void) +{ +#define pagetob(size) ((size) << (uvmexp.pageshift)) + struct uvmexp uvmexp; + int nswap, rnswap, i; + int mib[] = { CTL_VM, VM_UVMEXP }; + size_t size = sizeof (uvmexp); + + if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) + return 0; + + bm.mem_used = pagetob(uvmexp.active); + bm.mem_max = pagetob(uvmexp.npages); + bm.swap_used = 0; + bm.swap_max = 0; + if ((nswap = swapctl(SWAP_NSWAP, 0, 0)) != 0) { + struct swapent *swdev = malloc(nswap * sizeof(*swdev)); + if((rnswap = swapctl(SWAP_STATS, swdev, nswap)) != nswap) { + for (i = 0; i < nswap; i++) { + if (swdev[i].se_flags & SWF_ENABLE) { + bm.swap_used += (swdev[i].se_inuse / (1024 / DEV_BSIZE)); + bm.swap_max += (swdev[i].se_nblks / (1024 / DEV_BSIZE)); + } + } + } + free(swdev); + } + + return 1; +} + +#ifdef ENABLE_MEMSCREEN +void system_loadavg(void) +{ + static int avg_delay; + + if (avg_delay-- <= 0) { + struct loadavg loadinfo; + int i; + int mib[] = { CTL_VM, VM_LOADAVG }; + size_t size = sizeof (loadinfo); + + if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) >= 0) + for (i = 0; i < 3; i++) { + bm.loadavg[i].i = loadinfo.ldavg[i] / loadinfo.fscale; + bm.loadavg[i].f = ((loadinfo.ldavg[i] * 100 + + loadinfo.fscale / 2) / loadinfo.fscale) % 100; + } + + avg_delay = ROLLVALUE; + } +} +#endif /* ENABLE_MEMSCREEN */ + +/* ex:set sw=4 ts=4: */ diff --git a/sysutils/bubblemon-dockapp/patches/patch-Makefile b/sysutils/bubblemon-dockapp/patches/patch-Makefile new file mode 100644 index 00000000000..b6c93745182 --- /dev/null +++ b/sysutils/bubblemon-dockapp/patches/patch-Makefile @@ -0,0 +1,37 @@ +$OpenBSD: patch-Makefile,v 1.1.1.1 2001/08/28 14:24:28 wilfried Exp $ +--- Makefile.orig Fri Mar 16 08:00:22 2001 ++++ Makefile Mon Aug 27 17:56:55 2001 +@@ -10,17 +10,17 @@ PREFIX = /usr/local + # no user serviceable parts below + EXTRA += $(WMAN) + # optimization cflags +-CFLAGS = -O3 -ansi -Wall `gtk-config --cflags` ${EXTRA} ++CFLAGS += -Wall `gtk-config --cflags` ${EXTRA} + # profiling cflags + # CFLAGS = -ansi -Wall -pg -O3 `gtk-config --cflags` ${EXTRA} -DPRO + # test coverage cflags + # CFLAGS = -fprofile-arcs -ftest-coverage -Wall -ansi -g `gtk-config --cflags` ${EXTRA} -DPRO + + +-SHELL=sh ++#SHELL=sh + OS = $(shell uname -s) + OBJS = bubblemon.o +-CC = gcc ++#CC = gcc + + # special things for Linux + ifeq ($(OS), Linux) +@@ -34,6 +34,12 @@ ifeq ($(OS), FreeBSD) + OBJS += sys_freebsd.o + LIBS = `gtk-config --libs | sed "s/-lgtk//g"` -lkvm + INSTALL = -c -g kmem -m 2755 -o root ++endif ++ ++# special things for OpenBSD ++ifeq ($(OS), OpenBSD) ++ OBJS += sys_openbsd.o ++ LIBS = `gtk-config --libs | sed "s/-lgtk//g"` + endif + + #special things for SunOS diff --git a/sysutils/bubblemon-dockapp/pkg/DESCR b/sysutils/bubblemon-dockapp/pkg/DESCR new file mode 100644 index 00000000000..318985dc262 --- /dev/null +++ b/sysutils/bubblemon-dockapp/pkg/DESCR @@ -0,0 +1,5 @@ +This program is a dockapp-style CPU, memory, swap and load average +monitor. Based on the GNOME BubbleMon applet, this program has +been considerably improved. Many new features have been added. + +WWW: ${HOMEPAGE} diff --git a/sysutils/bubblemon-dockapp/pkg/PLIST b/sysutils/bubblemon-dockapp/pkg/PLIST new file mode 100644 index 00000000000..e519cf27d60 --- /dev/null +++ b/sysutils/bubblemon-dockapp/pkg/PLIST @@ -0,0 +1,4 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2001/08/28 14:24:28 wilfried Exp $ +bin/bubblemon +share/doc/bubblemon/README +@dirrm share/doc/bubblemon