summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-01-20 12:56:27 +0000
committerjoerg <joerg@pkgsrc.org>2007-01-20 12:56:27 +0000
commit46fe7db047aea1b6811496dade6155a2384ce3b1 (patch)
treed0d9424b7cae0648008232865f0271e38b855b33 /sysutils
parentc22a8b76184b36992fa808112722f4f376129fba (diff)
downloadpkgsrc-46fe7db047aea1b6811496dade6155a2384ce3b1.tar.gz
Add DragonFly and modular Xorg support.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/wmcpuload/Makefile7
-rw-r--r--sysutils/wmcpuload/distinfo3
-rw-r--r--sysutils/wmcpuload/files/cpu_dragonfly.c43
-rw-r--r--sysutils/wmcpuload/patches/patch-aa16
4 files changed, 67 insertions, 2 deletions
diff --git a/sysutils/wmcpuload/Makefile b/sysutils/wmcpuload/Makefile
index 83ba0c468e4..d4d6849b7c3 100644
--- a/sysutils/wmcpuload/Makefile
+++ b/sysutils/wmcpuload/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2006/12/15 20:33:01 joerg Exp $
+# $NetBSD: Makefile,v 1.10 2007/01/20 12:56:27 joerg Exp $
#
DISTNAME= wmcpuload-1.0.1
@@ -13,5 +13,10 @@ COMMENT= Dockable CPU monitor
GNU_CONFIGURE= YES
+post-extract:
+ ${CP} ${FILESDIR}/cpu_dragonfly.c ${WRKSRC}/src
+
+.include "../../x11/libXext/buildlink3.mk"
.include "../../x11/libXpm/buildlink3.mk"
+.include "../../x11/xextproto/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/wmcpuload/distinfo b/sysutils/wmcpuload/distinfo
index 45af15f3db3..4eed5e39138 100644
--- a/sysutils/wmcpuload/distinfo
+++ b/sysutils/wmcpuload/distinfo
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.3 2005/02/24 13:40:59 agc Exp $
+$NetBSD: distinfo,v 1.4 2007/01/20 12:56:27 joerg Exp $
SHA1 (wmcpuload-1.0.1.tar.bz2) = 6e767dd5acd291cfe3fc4fece5ff32eef78915e4
RMD160 (wmcpuload-1.0.1.tar.bz2) = 1ff01f09464dc8628acd7d375adcd106ea7ce317
Size (wmcpuload-1.0.1.tar.bz2) = 92457 bytes
+SHA1 (patch-aa) = 581eb45891beace0fae14cf77329921e9146762e
diff --git a/sysutils/wmcpuload/files/cpu_dragonfly.c b/sysutils/wmcpuload/files/cpu_dragonfly.c
new file mode 100644
index 00000000000..42daff42439
--- /dev/null
+++ b/sysutils/wmcpuload/files/cpu_dragonfly.c
@@ -0,0 +1,43 @@
+/*
+ * cpu_freebsd.c - module to get cpu usage, for DragonFly
+ *
+ * Copyright (c) 2007 Joerg Sonnenberger <joerg@leaf.dragonflybsd.org>
+ *
+ * Licensed under the GPL
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <kinfo.h>
+#include "cpu.h"
+
+void
+cpu_init(void)
+{
+}
+
+/* returns current CPU usage in percent */
+int
+cpu_get_usage(cpu_options *opts)
+{
+ static uint64_t old_used, old_total;
+ uint64_t used, total;
+ struct kinfo_cputime cp_time;
+ int usage;
+
+ if (kinfo_get_sched_cputime(&cp_time) < 0)
+ return 0;
+ used = cp_time.cp_user + cp_time.cp_sys;
+ if (!opts->ignore_nice)
+ used += cp_time.cp_nice;
+ total = used + cp_time.cp_idle;
+ if (old_total == 0 || total == old_total)
+ usage = 0;
+ else
+ usage = 100 * (used - old_used + used / 2 - old_used / 2) / (total - old_total);
+ old_used = used;
+ old_total = total;
+ return usage;
+}
diff --git a/sysutils/wmcpuload/patches/patch-aa b/sysutils/wmcpuload/patches/patch-aa
new file mode 100644
index 00000000000..91e3f913e54
--- /dev/null
+++ b/sysutils/wmcpuload/patches/patch-aa
@@ -0,0 +1,16 @@
+$NetBSD: patch-aa,v 1.3 2007/01/20 12:56:27 joerg Exp $
+
+--- configure.orig 2007-01-20 12:15:08.000000000 +0000
++++ configure
+@@ -4669,6 +4669,11 @@ freebsd*)
+ LIBS="$LIBS -lkvm"
+ SETGID_FLAGS="-g kmem -m 2755 -o root"
+ ;;
++dragonfly*)
++ OS=dragonfly
++ ignore_nice=yes
++ LIBS="$LIBS -lkinfo"
++ ;;
+ openbsd*)
+ OS=openbsd
+ ignore_nice=yes