Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

3
sysutils/bbsload/DESCR Normal file
View File

@@ -0,0 +1,3 @@
Small (in dimensions) tool to display various statistics like average
load during the last minute, last 5 minutes and 15 minutes, memory
usage, swap usage and CPU usage. Especially suited for BlackBox.

33
sysutils/bbsload/Makefile Normal file
View File

@@ -0,0 +1,33 @@
# $NetBSD: Makefile,v 1.15 2012/10/23 19:50:52 asau Exp $
#
DISTNAME= bbsload-0.2.6
PKGREVISION= 1
CATEGORIES= sysutils x11 wm
MASTER_SITES= http://bbtools.windsofstorm.net/sources/
MAINTAINER= pino@dohd.org
HOMEPAGE= http://bbtools.windsofstorm.net/
COMMENT= Small (in dimensions) tool to display the average load
GNU_CONFIGURE= YES
USE_LANGUAGES= c c++
USE_X11BASE= YES
INSTALLATION_DIRS= ${PKGMANDIR}/man1
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "DragonFly"
MAKE_ENV+= LIBS.pkgsrc=-lkinfo
.endif
post-install:
${INSTALL_MAN} ${WRKSRC}/bbsload.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/bbsload.1
BUILDLINK_DEPMETHOD.libXt?= build
.include "../../x11/libSM/buildlink3.mk"
.include "../../x11/libX11/buildlink3.mk"
.include "../../x11/libXt/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

6
sysutils/bbsload/PLIST Normal file
View File

@@ -0,0 +1,6 @@
@comment $NetBSD: PLIST,v 1.4 2009/06/14 21:28:47 joerg Exp $
bin/bbsload
man/man1/bbsload.1
share/bbtools/README.bbsload
share/bbtools/bbsload.bb
share/bbtools/bbsload.nobb

10
sysutils/bbsload/distinfo Normal file
View File

@@ -0,0 +1,10 @@
$NetBSD: distinfo,v 1.7 2013/01/11 23:30:17 joerg Exp $
SHA1 (bbsload-0.2.6.tar.gz) = 20e51d2888e7b62d8c8637d9ea66e71e07dcd18e
RMD160 (bbsload-0.2.6.tar.gz) = ab6d72a9d872ea60251051d26bf1fb84fc06641e
Size (bbsload-0.2.6.tar.gz) = 79258 bytes
SHA1 (patch-aa) = 861d984683fb248cd233539c8c325d61774c9aee
SHA1 (patch-ab) = 3a14f1b186939e75a74468f481583d49a2a30b4e
SHA1 (patch-ac) = 476ca12d419d2057ce256d0dcbcf262883f86bed
SHA1 (patch-ad) = 509a5fac20d76c84bf506ce457fe69c3ecbf36cb
SHA1 (patch-ae) = 5a59e5e9f312dfd1fb24177986ae938e3d0dddf8

View File

@@ -0,0 +1,366 @@
$NetBSD: patch-aa,v 1.3 2013/01/11 23:30:17 joerg Exp $
--- bbsload.cc.orig 2000-05-22 18:53:37.000000000 +0000
+++ bbsload.cc
@@ -21,6 +21,22 @@
#include "bbsload.hh"
+#ifdef __NetBSD__
+#define _KMEMUSER
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_extern.h>
+#elif defined(__DragonFly__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#define template
+#include <sys/user.h>
+#undef template
+#include <kinfo.h>
+#endif
+
CheckLoad::CheckLoad(ToolWindow *toolwindow) {
bbtool=toolwindow;
timer=new BTimer(bbtool->getCurrentScreenInfo()->getBaseDisplay(),this) ;
@@ -40,97 +54,106 @@ void CheckLoad::Reconfigure() {
void CheckLoad::timeout()
{
- FILE *fp;
-
- char loadstr[28];
- char buffer[128];
- bool redraw=False;
- struct stat file_status;
- static time_t last_mtime;
- static unsigned long old_user=0;
- static unsigned long old_nice=0;
- static unsigned long old_system=0;
- static unsigned long old_idle=0;
- broken=False;
+ static u_int64_t old_user=0, old_nice=0, old_system=0,
+ old_idle=0;
+ u_int64_t user,nice,system,idle,total;
+#if defined(__DragonFly__)
+ struct kinfo_cputime cpu_time;
+#else
+ u_int64_t cputimes[5];
+#endif
+ double lavg[3];
+#if defined(__DragonFly__)
+ size_t vm_stat_size = sizeof(struct vmstats);
+ struct vmstats vm_stat;
+#else
+ struct uvmexp uvm_stat;
+#endif
+ int ctl_name[3];
+ size_t ctllen;
- if (!(fp = fopen("/proc/loadavg", "r")))
- broken=True;
- else
- {
- fstat(fileno(fp),&file_status);
- if (file_status.st_mtime != last_mtime)
- {
- fgets(loadstr, 28, fp);
- sscanf(loadstr,"%e %e %e %d/%d",&load.average1m,
- &load.average5m,&load.average15m,&task.running,
- &task.total);
- redraw=true;
- }
- }
- fclose(fp);
- if (!(fp = fopen("/proc/meminfo", "r")))
- broken=True;
- else
- {
- fstat(fileno(fp),&file_status);
- if (file_status.st_mtime != last_mtime)
- {
- /* should work for now */
- fgets(buffer,128,fp);
- fgets(buffer,128,fp);
- sscanf(buffer,"Mem: %lu %lu %lu %lu %lu %lu",&mem.total,
- &mem.used,&mem.free,&mem.shared,&mem.buffers,
- &mem.cached);
- fgets(buffer,128,fp);
- sscanf(buffer,"Swap: %lu %lu %lu",
- &swap.total,&swap.used,&swap.free);
-
- norm.total_used=(double)(mem.used+swap.used)/
- (double)(mem.total+swap.total);
- norm.mem_used=(double)mem.used/(double)mem.total;
- if (swap.total!=0)
- norm.swap_used=(double)swap.used/(double)swap.total;
-
- redraw=true;
- }
- }
- fclose(fp);
+ int i;
- if (!(fp = fopen("/proc/stat", "r")))
- broken=True;
- else
- {
- fstat(fileno(fp),&file_status);
- if (file_status.st_mtime != last_mtime)
- {
- unsigned long user,nice,system,idle,total;
- /* should work for now */
- fgets(buffer,128,fp);
- sscanf(buffer,"cpu %lu %lu %lu %lu",&user,
- &nice,&system,&idle);
- total=(user-old_user)+(nice-old_nice)+
- (system-old_system)+(idle-old_idle);
+ broken=False;
- if ((total!=0)&(old_user!=0))
- {
- cpu.user=(user-old_user)/(double)total;
- cpu.nice=(nice-old_nice)/(double)user;
- cpu.system=(system-old_system)/(double)total;
- cpu.idle=(idle-old_idle)/(double)total;
- }
- else
- cpu.user=cpu.nice=cpu.system=cpu.idle=0;
+ /* Get system load */
- old_user=user;
- old_nice=nice;
- old_system=system;
- old_idle=idle;
- redraw=true;
- }
- }
- fclose(fp);
- if (redraw)
- bbtool->Redraw();
+ getloadavg(lavg,3);
+ load.average1m=lavg[0];
+ load.average5m=lavg[1];
+ load.average15m=lavg[2];
+
+ /* Get total amount of processes */
+
+ ctl_name[0]=CTL_KERN;
+ ctl_name[1]=KERN_PROC;
+ ctl_name[2]=KERN_PROC_ALL;
+ sysctl(ctl_name, 3, NULL, &ctllen,NULL,0); /* get size of proc table */
+ task.total=ctllen/sizeof(struct kinfo_proc); /* Anybody have an
+ alternative ? */
+
+#if defined(__DragonFly__)
+ sysctlbyname("vm.vmstats", &vm_stat, &vm_stat_size, NULL, 0);
+ mem.total = vm_stat.v_page_count;
+ mem.used = mem.total - vm_stat.v_free_count;
+ swap.total = 0; /* XXX fill me in, expensive! */
+ swap.used = 0;
+#else
+ /* task.running is missing */
+ /* get memory statistics */
+ ctllen=sizeof(uvm_stat);
+ ctl_name[0]=CTL_VM;
+ ctl_name[1]=VM_UVMEXP;
+ sysctl(ctl_name,2,&uvm_stat,&ctllen,NULL,0);
+
+ mem.total=uvm_stat.npages;
+ mem.used=uvm_stat.npages-uvm_stat.free;
+
+ swap.total=uvm_stat.swpages;
+ swap.used=uvm_stat.swpgonly; /* Only count pages in swap which are
+ not also present in memory */
+#endif
+
+ norm.total_used=(double)(mem.used+swap.used)/
+ (double)(mem.total+swap.total);
+ norm.mem_used=(double)mem.used/(double)mem.total;
+ if (swap.total!=0)
+ norm.swap_used=(double)swap.used/(double)swap.total;
+
+#if defined(__DragonFly__)
+ kinfo_get_sched_cputime(&cpu_time);
+ user = cpu_time.cp_user;
+ nice = cpu_time.cp_nice;
+ system = cpu_time.cp_sys + cpu_time.cp_intr;
+ idle = cpu_time.cp_idle;
+#else
+ ctl_name[0]=CTL_KERN;
+ ctl_name[1]=KERN_CP_TIME;
+ ctllen=sizeof(cputimes);
+ if(sysctl(ctl_name,2,cputimes,&ctllen,NULL,0))
+ perror("sysctl");
+ user=cputimes[0];
+ nice=cputimes[1];
+ system=cputimes[2] /*sys*/
+ +cputimes[3]/*intr*/;
+ idle=cputimes[4];
+#endif
+ total=(user-old_user)+(nice-old_nice)+
+ (system-old_system)+(idle-old_idle);
+ if ((total!=0)&(old_user!=0))
+ {
+ cpu.user=(double)(user-old_user)/(double)total;
+ cpu.nice=(double)(nice-old_nice)/(double)total;
+ cpu.system=(double)(system-old_system)/(double)total;
+ cpu.idle=(double)(idle-old_idle)/(double)total;
+ }
+ else
+ cpu.user=cpu.nice=cpu.system=cpu.idle=0;
+ old_user=user;
+ old_nice=nice;
+ old_system=system;
+ old_idle=idle;
+ bbtool->Redraw();
}
@@ -233,15 +256,15 @@ void ToolWindow::MakeWindow(bool reconfi
label_counter++;
}
if (resource->show.label_totalused) {
- label.width[6] = XTextWidth(resource->label.font,"0.00",strlen("0.00"));
+ label.width[8] = XTextWidth(resource->label.font,"0.00",strlen("0.00"));
label_counter++;
}
if (resource->show.label_memused) {
- label.width[7] = XTextWidth(resource->label.font,"0.00",strlen("0.00"));
+ label.width[6] = XTextWidth(resource->label.font,"0.00",strlen("0.00"));
label_counter++;
}
if (resource->show.label_swapused) {
- label.width[8] = XTextWidth(resource->label.font,"0.00",strlen("0.00"));
+ label.width[7] = XTextWidth(resource->label.font,"0.00",strlen("0.00"));
label_counter++;
}
if (resource->show.label_usercpu) {
@@ -545,7 +568,7 @@ void ToolWindow::RedrawGauge(double leve
}
}
-void ToolWindow::RedrawLabel(double level,int labelnr)
+void ToolWindow::RedrawLabel(double level,int labelnr,int idx, BColor colour)
{
char t[6];
@@ -561,15 +584,14 @@ void ToolWindow::RedrawLabel(double leve
xposition+=label.seperator_width;
}
- XSetForeground(getXDisplay(),frameGC,
- resource->label.load1m_textColor.getPixel());
+ XSetForeground(getXDisplay(),frameGC, colour.getPixel());
labelnr++;
sprintf(t,"%1.2f",level);
XDrawString(getXDisplay(), labelwin, frameGC, xposition,
(label.height+resource->label.font->ascent-
resource->label.font->descent) / 2,
t, strlen(t));
- xposition+=label.width[2];
+ xposition+=label.width[idx];
}
void ToolWindow::Redraw()
@@ -577,12 +599,12 @@ void ToolWindow::Redraw()
int offset=0;
if (resource->show.load1m)
{
- RedrawGauge(check_load->getLoad().average1m,offset);
+ RedrawGauge(check_load->getLoad().average1m,offset);
offset++;
}
if (resource->show.load5m)
{
- RedrawGauge(check_load->getLoad().average5m,offset);
+ RedrawGauge(check_load->getLoad().average5m,offset);
offset++;
}
if (resource->show.load15m)
@@ -678,53 +700,63 @@ void ToolWindow::Redraw()
if (resource->show.label_load1m)
{
- RedrawLabel(check_load->getLoad().average1m,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getLoad().average1m,offset,2,
+ resource->label.load1m_textColor);
+ offset++;
}
if (resource->show.label_load5m)
{
- RedrawLabel(check_load->getLoad().average5m,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getLoad().average5m,offset,3,
+ resource->label.load5m_textColor);
+ offset++;
}
if (resource->show.label_load15m)
{
- RedrawLabel(check_load->getLoad().average15m,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getLoad().average15m,offset,4,
+ resource->label.load15m_textColor);
+ offset++;
}
if (resource->show.label_memused)
{
- RedrawLabel(check_load->getNorm().mem_used,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getNorm().mem_used,offset,6,
+ resource->label.memUsed_textColor);
+ offset++;
}
if (resource->show.label_swapused)
{
- RedrawLabel(check_load->getNorm().swap_used,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getNorm().swap_used,offset,7,
+ resource->label.swapUsed_textColor);
+ offset++;
}
if (resource->show.label_totalused)
{
- RedrawLabel(check_load->getNorm().total_used,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getNorm().total_used,offset,8,
+ resource->label.totalUsed_textColor);
+ offset++;
}
if (resource->show.label_usercpu)
{
- RedrawLabel(check_load->getCpu().user,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getCpu().user,offset,9,
+ resource->label.seperator_textColor);
+ offset++;
}
if (resource->show.label_nicecpu)
{
- RedrawLabel(check_load->getCpu().nice,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getCpu().nice,offset,10,
+ resource->label.seperator_textColor);
+ offset++;
}
if (resource->show.label_systemcpu)
{
- RedrawLabel(check_load->getCpu().system,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getCpu().system,offset,11,
+ resource->label.seperator_textColor);
+ offset++;
}
if (resource->show.label_idlecpu)
{
- RedrawLabel(check_load->getCpu().idle,labelnr);
- labelnr++;
+ RedrawLabel(check_load->getCpu().idle,offset,12,
+ resource->label.seperator_textColor);
+ offset++;
}
}

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-ab,v 1.1.1.1 2002/04/16 21:49:27 wiz Exp $
--- bbsload.hh.orig Sun Apr 9 12:27:34 2000
+++ bbsload.hh
@@ -150,7 +150,7 @@
void reconfigure(void);
void CheckConfig(void);
void RedrawGauge(double,int);
- void RedrawLabel(double,int);
+ void RedrawLabel(double,int,int,BColor);
bool raised;
Resource *getResource(void) { return(resource); }
protected:

View File

@@ -0,0 +1,78 @@
$NetBSD: patch-ac,v 1.1 2003/03/18 01:07:57 jschauma Exp $
--- /dev/null Mon Mar 17 19:52:07 2003
+++ bbsload.1 Mon Mar 17 19:53:44 2003
@@ -0,0 +1,73 @@
+.TH BBSLOAD 1 "March 14, 2003" bbsload "bbtools"
+.SH NAME
+bbsload \- system load tool for Blackbox
+
+.SH SYNOPSIS
+.B bbsload
+[\fIOPTIONS\fR]
+
+.SH DESCRIPTION
+\fBbbsload\fR is a Blackbox tool to display your system load.
+
+It can show simple system bar graphs, including load averages for 1, 5 and 15
+minute periods, memory usage, swap usage, total system usage, as well as CPU
+loads for user, nice and system processes and idle time.
+
+.SH USAGE
+By default \fBbbsload\fR reads the Blackbox style-file as defined in
+\fI$HOME/.blackboxrc\fR and copies as much of the style as possible. The
+result is an application which looks a lot like the toolbar.
+
+The \fI-geometry\fR is given as +x+y or -x-y (or combination)
+where -x-y is the (x,y) distance of the right bottom of screen
+to the right bottom of \fBbbsload\fR.
+
+So \fI-geometry -0-0\fR puts the application in the lower right corner of the
+screen.
+
+.SH OPTIONS
+A summary of the options supported by \fBbbsload\fR is included below.
+
+.TP
+\fB\-display\fR \fIdisplay name\fR
+X server to connect to
+.TP
+\fB\-c[onfig]\fR \fIfilename\fR
+use alternate config file
+.TP
+.B \-d[ecorated]
+Show 'normal' decorated window
+.TP
+\fB\-geom[etry]\fR \fIgeometry\fR
+Set geometry of window
+.TP
+\fB\-h[elp]\fR
+Show summary of options and exit.
+.TP
+\fB\-n[obb]\fR
+fall back on default configuration
+.TP
+\fB\-s[hape]\fR
+Don't display groundplate
+.TP
+\fB\-v[ersion]\fR
+Display version number
+.TP
+\fB\-w[ithdrawn]\fR
+Place bbtool in the Slit
+
+.SH FILES
+Default: \fI$datadir=/usr/local/share/\fR
+.br
+.SS "Under Blackbox"
+.nf
+\fI$datadir/bbtools/bbsload.bb\fR the global configuration file
+\fI$HOME/.bbtools/bbsload.bb\fR a local configuration file
+
+.SS "Under other Window managers"
+.nf
+\fI$datadir/bbtools/bbsload.nobb\fR the global configuration file
+\fI$HOME/.bbtools/bbsload.nobb\fR a local configuration file
+
+.SH AUTHOR
+This manual page was written by Emanuele Rocca <emarocca@libero.it>, for the Debian GNU/Linux system (but may be used by others).

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-ad,v 1.1 2007/02/15 21:46:54 joerg Exp $
--- Makefile.in.orig 2007-02-15 21:26:21.000000000 +0000
+++ Makefile.in
@@ -83,7 +83,7 @@ PROGRAMS = $(bin_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir)
LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LIBS = @LIBS@ ${LIBS.pkgsrc}
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-ae,v 1.1 2007/11/30 20:35:20 rillig Exp $
--- resource.hh.orig 2000-04-09 10:27:34.000000000 +0000
+++ resource.hh 2007-11-30 20:33:39.000000000 +0000
@@ -114,8 +114,8 @@ class Resource : public BaseResource
{
public:
- Resource::Resource(ToolWindow *);
- Resource::~Resource(void);
+ Resource(ToolWindow *);
+ ~Resource(void);
struct FRAME frame;
struct LABEL label;