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

20
sysutils/torsmo/DESCR Normal file
View File

@@ -0,0 +1,20 @@
Torsmo is a system monitor that sits in the corner of your desktop. It's
very simple, customizable and it renders only text on the desktop (and
percentagebars if you want it to ;) and the only lib it uses is Xlib.
Torsmo can show various information about your system and its peripherals,
including:
* Kernel version
* Uptime
* System time
* Network interface information
* Memory and swap usage
* Hostname
* Machine, i686 for example
* System name, Linux for example
* Temperatures from i2c-sensors
* Temperature from ACPI
* Battery capacity from ACPI/APM
* Number of processes running or sleeping
* Local mails (unread and all)
* Filesystem stats

46
sysutils/torsmo/Makefile Normal file
View File

@@ -0,0 +1,46 @@
# $NetBSD: Makefile,v 1.11 2013/04/13 07:55:03 ghen Exp $
DISTNAME= torsmo-0.18
PKGREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=torsmo/}
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://torsmo.sourceforge.net/
COMMENT= Tyopoytaorvelo System Monitor
NOT_FOR_PLATFORM= Darwin-*-*
GNU_CONFIGURE= yes
EGDIR= ${PREFIX}/share/examples/torsmo
DOCDIR= ${PREFIX}/share/doc/torsmo
INSTALLATION_DIRS= bin ${PKGMANDIR}/man1 share/examples/torsmo
INSTALLATION_DIRS+= share/doc/torsmo
.include "../../mk/bsd.prefs.mk"
.if ${X11_TYPE} == "modular"
CONFIGURE_ARGS+= --x-includes=${PREFIX}/include
CONFIGURE_ARGS+= --x-libraries=${PREFIX}/lib
.endif
.if (${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD" \
|| ${OPSYS} == "OpenBSD" || ${OPSYS} == "Linux")
SPECIAL_PERMS+= bin/torsmo ${REAL_ROOT_USER} kmem 2555
.endif
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/torsmo ${DESTDIR}${PREFIX}/bin/
${INSTALL_MAN} ${WRKSRC}/torsmo.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/
${INSTALL_DATA} ${WRKSRC}/torsmorc.sample ${DESTDIR}${EGDIR}/
${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${DOCDIR}/
${INSTALL_DATA} ${WRKSRC}/readme.html ${DESTDIR}${DOCDIR}/
BUILDLINK_DEPMETHOD.libXt?= build
.include "../../x11/libX11/buildlink3.mk"
.include "../../x11/libXext/buildlink3.mk"
.include "../../x11/libXt/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

6
sysutils/torsmo/PLIST Normal file
View File

@@ -0,0 +1,6 @@
@comment $NetBSD: PLIST,v 1.2 2009/06/14 18:16:15 joerg Exp $
bin/torsmo
man/man1/torsmo.1
share/doc/torsmo/README
share/doc/torsmo/readme.html
share/examples/torsmo/torsmorc.sample

10
sysutils/torsmo/distinfo Normal file
View File

@@ -0,0 +1,10 @@
$NetBSD: distinfo,v 1.5 2010/10/31 23:38:32 wiz Exp $
SHA1 (torsmo-0.18.tar.gz) = 01e6737b3971daa3a7c9cb6dd1961f61bc39bdae
RMD160 (torsmo-0.18.tar.gz) = f1d8b3c4679155596569f9116970e7ba8a01eb6e
Size (torsmo-0.18.tar.gz) = 84020 bytes
SHA1 (patch-aa) = 8c515d3b0925aeaaea928ad8abd89ab5ccbfceab
SHA1 (patch-ab) = 3bf66bd2b7645c204099a8c7b806098d028cc8bf
SHA1 (patch-ac) = 5b342d09ff0fcc3982aa855e2cc660823ed53e11
SHA1 (patch-ad) = 87fa39455dc2d5190c419142d5e4d0768914841e
SHA1 (patch-ae) = 5888d6cf538a9d95006ab1d2cdd01eabfafa10ed

View File

@@ -0,0 +1,43 @@
$NetBSD: patch-aa,v 1.2 2007/12/02 12:55:11 wiz Exp $
--- fs.c.orig 2004-08-25 18:24:24.000000000 +0200
+++ fs.c
@@ -19,6 +19,11 @@
#include <sys/mount.h>
#endif
+#if defined (__NetBSD__) && (__NetBSD_Version__ >= 299000900)
+#include <sys/statvfs.h>
+#define STATVFS 1
+#endif
+
/* TODO: benchmark which is faster, fstatvfs() or pre-opened fd and
* statvfs() (fstatvfs() would handle mounts I think...) */
@@ -27,16 +32,25 @@ struct fs_stat *fs_stats = fs_stats_;
void update_fs_stats() {
unsigned int i;
+#ifndef STATVFS
struct statfs s;
+#else
+ struct statvfs s;
+#endif
for (i=0; i<16; i++) {
if (fs_stats[i].fd <= 0)
break;
+#ifndef STATVFS
fstatfs(fs_stats[i].fd, &s);
-
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_bsize;
+#else
+ fstatvfs(fs_stats[i].fd, &s);
+ fs_stats[i].size = (int64_t) s.f_blocks * 1024;
+ fs_stats[i].avail = (int64_t) s.f_bavail * 1024;
+#endif
}
}

View File

@@ -0,0 +1,155 @@
$NetBSD: patch-ab,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
--- netbsd.c.orig 2004-08-25 19:55:57.000000000 +0200
+++ netbsd.c
@@ -9,6 +9,7 @@
#include <err.h>
#include <limits.h>
#include <paths.h>
+#include <ctype.h>
#include <kvm.h>
#include <nlist.h>
@@ -221,6 +222,33 @@ void update_net_stats()
}
}
+static char *freq = NULL;
+char * get_freq()
+{
+ size_t val_len;
+ u_int32_t val;
+
+ if (freq == NULL) {
+ freq = malloc(10);
+ if (freq == NULL) {
+ return NULL;
+ } else {
+ freq[0] = '\0';
+ }
+ }
+
+ /* Laptops with enhanced speed step. */
+ if (sysctlbyname("machdep.est.frequency.current",
+ NULL, &val_len, NULL, 0) == 0) {
+ sysctlbyname("machdep.est.frequency.current", &val, &val_len, NULL, 0);
+ sprintf(freq, "%d", val);
+ } else {
+ /* XXX: Parse out the clockspeed from machdep.cpu_brand */
+ }
+
+ return freq;
+}
+
void update_total_processes()
{
/* It's easier to use kvm here than sysctl */
@@ -302,6 +330,7 @@ void update_cpu_usage()
}
double get_i2c_info(int fd, int div) {
+ (void) fd; (void) div;
return -1;
}
@@ -315,24 +344,96 @@ void update_load_average() {
}
double get_acpi_temperature(int fd) {
+ (void) fd;
return -1;
}
-void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
-}
-
int open_i2c_sensor(const char *dev, const char *type, int n, int *div)
{
+ (void) dev; (void) type; (void) n; (void) div;
return -1;
}
int open_acpi_temperature(const char *name) {
+ (void) name;
return -1;
}
+static char acpi_ac_str[64] = "N/A";
char * get_acpi_ac_adapter(void)
{
- return "N/A";
+ /* get_battery_stuff() actually populates this for us. */
+ return acpi_ac_str;
+}
+
+static char last_battery_str[64];
+static double last_battery_time;
+
+void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
+ FILE *f;
+ char *foo;
+ char b[4096];
+ char b_name[32];
+ int bat_num;
+ int found_acpibat = 0;
+ int found_acpiacad = 0;
+ float bat_charge = 0.0;
+
+ /* Don't update battery too often. */
+ if (current_update_time - last_battery_time < 29.5) {
+ snprintf(buf, n, "%s", last_battery_str);
+ return;
+ }
+ last_battery_time = current_update_time;
+
+ sscanf(bat, "BAT%d", &bat_num);
+ sprintf(b_name, "acpibat%d", bat_num);
+
+ /*
+ * Using the envsys API is like pulling teeth without anesthetic.
+ * so just popen envstat and parse the output instead.
+ */
+ f = popen("/usr/sbin/envstat -r", "r");
+ if (f != NULL) {
+ while(!feof(f)) {
+ fgets(b, 4096, f);
+
+ /* AC adapter state. */
+ if (strstr(b, "acpiacad0")) {
+ if (strstr(b, "disconnected")) {
+ sprintf(acpi_ac_str, "disconnected");
+ } else {
+ sprintf(acpi_ac_str, "connected");
+ }
+ found_acpiacad = 1;
+ }
+
+ if (bat && strstr(b, b_name)) {
+ if (strstr(b, "charge:")) {
+ foo = strstr(b, "%)");
+ while (*foo != ' ' && *foo != '(') {
+ foo--;
+ }
+ foo = foo + 1;
+ sscanf(foo, "%f", &bat_charge);
+ found_acpibat = 1;
+ }
+ }
+ }
+ pclose(f);
+ }
+
+ if (found_acpibat) {
+ snprintf(last_battery_str, 64, "%.2f%%", bat_charge);
+ snprintf(buf, n, "%s", last_battery_str);
+ } else {
+ /* XXX: If that failed, try to use APM. */
+ }
+
+ if (!found_acpiacad) {
+ sprintf(acpi_ac_str, "N/A");
+ }
+
}
char* get_acpi_fan() {

View File

@@ -0,0 +1,19 @@
$NetBSD: patch-ac,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
--- torsmo.c.orig 2004-12-21 23:14:46.000000000 +0100
+++ torsmo.c
@@ -888,12 +888,14 @@ static void generate_text() {
OBJ(freq) {
snprintf(p, n, "%s", get_freq());
}
+#if defined(__linux__)
OBJ(adt746xcpu) {
snprintf(p, n, "%s", get_adt746x_cpu());
}
OBJ(adt746xfan) {
snprintf(p, n, "%s", get_adt746x_fan());
}
+#endif
OBJ(acpifan) {
snprintf(p, n, "%s", get_acpi_fan());
}

View File

@@ -0,0 +1,64 @@
$NetBSD: patch-ad,v 1.2 2007/02/19 19:50:48 joerg Exp $
--- configure.orig 2004-12-21 21:57:05.000000000 +0000
+++ configure
@@ -795,11 +795,15 @@ fi
uname=`uname`
+if test "$uname" = "DragonFly"; then
+ LIBS="$LIBS -lkinfo"
+fi
+
case $uname in
Linux*)
WANT_SYSINFO=yes
;;
- FreeBSD*)
+ FreeBSD*|DragonFly*)
WANT_KVM=yes
;;
NetBSD*)
@@ -839,7 +843,7 @@ else
fi
-if test x$uname = xFreeBSD; then
+if test x$uname = xFreeBSD || test x$uname = xDragonFly; then
BUILD_FREEBSD_TRUE=
BUILD_FREEBSD_FALSE='#'
else
@@ -924,14 +928,14 @@ fi
-if test x$want_seti == xyes; then
+if test x$want_seti = xyes; then
BUILD_SETI_TRUE=
BUILD_SETI_FALSE='#'
else
BUILD_SETI_TRUE='#'
BUILD_SETI_FALSE=
fi
-if test x$want_seti == xyes; then
+if test x$want_seti = xyes; then
cat >> confdefs.h <<\EOF
#define SETI 1
EOF
@@ -949,14 +953,14 @@ fi
-if test x$want_nvctrl == xyes; then
+if test x$want_nvctrl = xyes; then
BUILD_NVCTRL_TRUE=
BUILD_NVCTRL_FALSE='#'
else
BUILD_NVCTRL_TRUE='#'
BUILD_NVCTRL_FALSE=
fi
-if test x$want_nvctrl == xyes; then
+if test x$want_nvctrl = xyes; then
cat >> confdefs.h <<\EOF
#define NVCTRL 1
EOF

View File

@@ -0,0 +1,69 @@
$NetBSD: patch-ae,v 1.2 2010/10/31 23:38:32 wiz Exp $
--- freebsd.c.orig 2004-08-25 18:24:24 +0200
+++ freebsd.c 2010-10-31 18:52:50 +0100
@@ -13,7 +13,11 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/vmmeter.h>
+#ifdef __DragonFly__
+#include <kinfo.h>
+#else
#include <sys/dkstat.h>
+#endif
#include <unistd.h>
#include <sys/user.h>
#include <sys/socket.h>
@@ -229,11 +233,15 @@ void update_running_processes() {
if (kd != NULL) {
p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
for (i = 0; i<n_processes; i++) {
+#ifdef __DragonFly__
+ if (p[i].kp_stat == LSRUN)
+#else
#if __FreeBSD__ < 5
if (p[i].kp_proc.p_stat == SRUN)
#else
if (p[i].ki_stat == SRUN)
#endif
+#endif /* __DragonFly__ */
cnt++;
}
} else
@@ -251,6 +259,19 @@ long cpu_used, oldtotal, oldused;
void update_cpu_usage() {
long used, total;
+#ifdef __DragonFly__
+ struct kinfo_cputime cp_time;
+
+ if (kinfo_get_sched_cputime(&cp_time)) {
+ fprintf(stderr, "kinfo_get_sched_cputime failed");
+ return;
+ }
+ fresh.load[0] = cp_time.cp_user;
+ fresh.load[1] = cp_time.cp_nice;
+ fresh.load[2] = cp_time.cp_sys;
+ fresh.load[3] = cp_time.cp_idle;
+ fresh.load[4] = cp_time.cp_idle;
+#else
long cp_time[CPUSTATES];
size_t len = sizeof(cp_time);
@@ -263,6 +284,7 @@ void update_cpu_usage() {
fresh.load[2] = cp_time[CP_SYS];
fresh.load[3] = cp_time[CP_IDLE];
fresh.load[4] = cp_time[CP_IDLE];
+#endif
used = fresh.load[0] + fresh.load[1] + fresh.load[2];
total = fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3];
@@ -345,3 +367,8 @@ char* get_acpi_ac_adapter(void)
char* get_acpi_fan() {
return "";
}
+
+char * get_freq()
+{
+ return "";
+}