pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/gkrellm Add DragonFly support.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6164ec1ddd97
branches:  trunk
changeset: 509936:6164ec1ddd97
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Mar 19 22:10:38 2006 +0000

description:
Add DragonFly support.

diffstat:

 sysutils/gkrellm/Makefile               |     4 +-
 sysutils/gkrellm/Makefile.common        |     3 +-
 sysutils/gkrellm/distinfo               |    19 +-
 sysutils/gkrellm/files/dragonfly.c      |  1151 +++++++++++++++++++++++++++++++
 sysutils/gkrellm/files/server.Makefile  |     2 +-
 sysutils/gkrellm/files/src.Makefile     |     3 +-
 sysutils/gkrellm/files/top.Makefile.inc |     9 +-
 sysutils/gkrellm/patches/patch-aa       |    13 +-
 sysutils/gkrellm/patches/patch-ae       |    39 +-
 sysutils/gkrellm/patches/patch-aj       |    15 +-
 sysutils/gkrellm/patches/patch-ao       |    24 +-
 sysutils/gkrellm/patches/patch-ap       |    32 +-
 sysutils/gkrellm/patches/patch-ar       |    13 +-
 sysutils/gkrellm/patches/patch-au       |    13 +
 sysutils/gkrellm/patches/patch-av       |    19 +
 sysutils/gkrellm/patches/patch-aw       |    13 +
 sysutils/gkrellm/patches/patch-ax       |    13 +
 sysutils/gkrellm/patches/patch-ay       |    17 +
 18 files changed, 1362 insertions(+), 40 deletions(-)

diffs (truncated from 1589 to 300 lines):

diff -r 15f088d096c6 -r 6164ec1ddd97 sysutils/gkrellm/Makefile
--- a/sysutils/gkrellm/Makefile Sun Mar 19 22:04:05 2006 +0000
+++ b/sysutils/gkrellm/Makefile Sun Mar 19 22:10:38 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.49 2006/02/05 23:10:50 joerg Exp $
+# $NetBSD: Makefile,v 1.50 2006/03/19 22:10:38 joerg Exp $
 .include "Makefile.common"
 
 GKRELLM_PKGBASE=       gkrellm
@@ -14,7 +14,7 @@
 .include "../../mk/bsd.prefs.mk"
 
 # NetBSD 3.99.1 and above don't have to be installed setgid.
-.if (${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD" || \
+.if (${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD" || ${OPSYS} == "DragonFly" || \
     (${OPSYS} == "NetBSD" && (!empty(OS_VERSION:M[123]*) && empty(OS_VERSION:M3.99.*))))
 SPECIAL_PERMS+=                ${PREFIX}/bin/gkrellm ${ROOT_USER} kmem 2711
 .endif
diff -r 15f088d096c6 -r 6164ec1ddd97 sysutils/gkrellm/Makefile.common
--- a/sysutils/gkrellm/Makefile.common  Sun Mar 19 22:04:05 2006 +0000
+++ b/sysutils/gkrellm/Makefile.common  Sun Mar 19 22:10:38 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.common,v 1.13 2005/12/05 20:51:00 rillig Exp $
+# $NetBSD: Makefile.common,v 1.14 2006/03/19 22:10:38 joerg Exp $
 
 DISTNAME=      ${GKRELLM_DISTBASE}
 PKGNAME=       ${GKRELLM_PKGBASE}-${GKRELLM_VERSION}
@@ -35,3 +35,4 @@
        ${CP} ${FILESDIR}/po.Makefile ${WRKSRC}/po/Makefile
        ${CP} ${FILESDIR}/server.Makefile ${WRKSRC}/server/Makefile
        ${CP} ${FILESDIR}/src.Makefile ${WRKSRC}/src/Makefile
+       ${CP} ${FILESDIR}/dragonfly.c ${WRKSRC}/src/sysdeps
diff -r 15f088d096c6 -r 6164ec1ddd97 sysutils/gkrellm/distinfo
--- a/sysutils/gkrellm/distinfo Sun Mar 19 22:04:05 2006 +0000
+++ b/sysutils/gkrellm/distinfo Sun Mar 19 22:10:38 2006 +0000
@@ -1,23 +1,28 @@
-$NetBSD: distinfo,v 1.34 2005/09/08 13:19:56 cube Exp $
+$NetBSD: distinfo,v 1.35 2006/03/19 22:10:38 joerg Exp $
 
 SHA1 (gkrellm-2.2.7.tar.bz2) = a6910b6f843868b4d801f7f7873e1e85c4f2039c
 RMD160 (gkrellm-2.2.7.tar.bz2) = 5388e3fba604a7c4b99a9c134ab6526296fe70d8
 Size (gkrellm-2.2.7.tar.bz2) = 673728 bytes
-SHA1 (patch-aa) = 9dbffbc0bc95ea3fced7162da0ec55333396d256
+SHA1 (patch-aa) = bc07107ed828a5a86012cae39316c1d35d2d7a4d
 SHA1 (patch-ab) = 015ed1c6b4d07d2da6aeefab2b746bff3fa1a88e
 SHA1 (patch-ac) = 8890d5a5e8eaf21508a1bf91de788183fd6f7a75
 SHA1 (patch-ad) = 18218e5e9e7a8cfaabb20ec03865670ae66a15bd
-SHA1 (patch-ae) = 5f7b1bdfa99bcec9cfdaee3a97b38b27581dd954
+SHA1 (patch-ae) = d9670d5956daaf768276a7b27b1831cbfc5cf4cb
 SHA1 (patch-ag) = 6791436e17fccd7265cda8b4e3da229c4937c20f
 SHA1 (patch-ah) = 2018be5c2dd11c22c6d3f7c7fc8607e2c63123f3
 SHA1 (patch-ai) = 234e3e1e458e5709157668cf7d18faabdd076071
-SHA1 (patch-aj) = f61f36d1d82388e1d88eb78ec3107be4f8c9cf2b
+SHA1 (patch-aj) = 224deaa57e7703f34a7911c63d2e6833862920c5
 SHA1 (patch-ak) = b96987c120ca4c37c83075da61e8eb04e41d2023
 SHA1 (patch-al) = 4eab3c3757c198dcc3049a63fc3b8adceef7bc1c
 SHA1 (patch-am) = bf8b01f5e368a5387f8d224ca51ec18a74410b5c
 SHA1 (patch-an) = 1e63ce0e4fbe9bd22c46d00c6aeac6b3e7cda440
-SHA1 (patch-ao) = 63bf8657fa7707def41b13b3cc74c031098e070a
-SHA1 (patch-ap) = b3c89911085e73b8651e35f71b9561046b3cd073
+SHA1 (patch-ao) = afc56bb647c6b3bb9eba90b0b18d918dcf31a100
+SHA1 (patch-ap) = b2c33796fdfdc0166a869e528fcaab1f8f0ab615
 SHA1 (patch-aq) = 0799e334333ae072a40cdcb6ccd04ed6a2f52765
-SHA1 (patch-ar) = eae37435d69b277f2542ee5ff26cbc772272689b
+SHA1 (patch-ar) = 86ee88c8506c1ceb1d35eb488d209b16306a715d
 SHA1 (patch-as) = 3df33e28754cf1fee88717b431726bf090c15f70
+SHA1 (patch-au) = 27df64d854cb15202fa984170faeab4c128d5cad
+SHA1 (patch-av) = 09cbc2fbb8226f8fe56bff458a4772998cae3f32
+SHA1 (patch-aw) = c32ae045dad9754edb88e375b8893cfe161567d0
+SHA1 (patch-ax) = 4377fa60acbc701c2cb78636574168820af2b936
+SHA1 (patch-ay) = bc512682f19631273a372581c6e091c7465e98d6
diff -r 15f088d096c6 -r 6164ec1ddd97 sysutils/gkrellm/files/dragonfly.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/gkrellm/files/dragonfly.c        Sun Mar 19 22:10:38 2006 +0000
@@ -0,0 +1,1151 @@
+/* GKrellM
+|  Copyright (C) 1999-2005 Bill Wilson
+|
+|  Author:  Bill Wilson    bill%gkrellm.net@localhost
+|  Latest versions might be found at:  http://gkrellm.net
+|
+|  DragonFly code: Joerg Sonnenberger <joerg%bec.de@localhost>
+|  Derived from FreeBSD code: Hajimu UMEMOTO <ume%FreeBSD.org@localhost>
+|
+|  This program is free software which I release under the GNU General Public
+|  License. You may redistribute and/or modify this program under the terms
+|  of that 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.  Version 2 is in the
+|  COPYRIGHT file in the top level directory of this distribution.
+| 
+|  To get a copy of the GNU General Puplic License, write to the Free Software
+|  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <kvm.h>
+
+kvm_t  *kvmd = NULL;
+char   errbuf[_POSIX2_LINE_MAX];
+
+
+// extern gboolean force_meminfo_update(void);
+#if defined(__i386__)
+static void scan_for_sensors();
+#endif
+
+
+void
+gkrellm_sys_main_init(void)
+       {
+       /* We just ignore error, here.  Even if GKrellM doesn't have
+       |  kmem privilege, it runs with available information.
+       */
+       kvmd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
+       if (setgid(getgid()) != 0)
+               {
+               fprintf(stderr, "Can't drop setgid privileges.");
+               exit(1);
+               }
+#if defined(__i386__)
+       scan_for_sensors();
+#endif
+       if (setuid(getuid()) != 0)
+               {
+               fprintf(stderr, "Can't drop setuid privileges.");
+               exit(1);
+               }
+       }
+
+void
+gkrellm_sys_main_cleanup(void)
+       {
+       }
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+static int
+gk_sysctlnametomib(const char *name, int *mibp, size_t *lenp)
+       {
+       static int      oid_name2oid[2] = { 0, 3 };
+
+       if (sysctl(oid_name2oid, 2, mibp, lenp,
+                  (void *)name, strlen(name)) < 0)
+               return -1;
+       *lenp /= sizeof(int);
+       return 0;
+       }
+
+/* ===================================================================== */
+/* CPU monitor interface */
+
+#include <kinfo.h>
+#include <kvm.h>
+
+
+extern kvm_t   *kvmd;
+
+void
+gkrellm_sys_cpu_read_data(void)
+{
+       struct kinfo_cputime cp_time;
+
+       if (kinfo_get_sched_cputime(&cp_time))
+               return;
+
+       gkrellm_cpu_assign_data(0, cp_time.cp_user, cp_time.cp_nice,
+                               cp_time.cp_sys, cp_time.cp_idle);
+}
+
+gboolean
+gkrellm_sys_cpu_init(void)
+{
+       gkrellm_cpu_set_number_of_cpus(1);
+       return TRUE;
+}
+
+
+/* ===================================================================== */
+/* Proc monitor interface */
+
+#include <osreldate.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+
+/*
+ * This is ugly, but we need PID_MAX, in anyway.  Since 5.0-RELEASE
+ * will have vm.stats.vm.v_forks, this will be obsolete in the future.
+ */
+#define        PID_MAX         99999
+
+#include <kvm.h>
+#include <limits.h>
+#include <paths.h>
+#include <utmp.h>
+
+extern kvm_t   *kvmd;
+
+static int     oid_v_forks[CTL_MAXNAME + 2];
+static int     oid_v_vforks[CTL_MAXNAME + 2];
+static int     oid_v_rforks[CTL_MAXNAME + 2];
+static size_t  oid_v_forks_len = sizeof(oid_v_forks);
+static size_t  oid_v_vforks_len = sizeof(oid_v_vforks);
+static size_t  oid_v_rforks_len = sizeof(oid_v_rforks);
+
+gboolean
+gkrellm_sys_proc_init(void)
+       {
+       static const char       *name = "vm.stats.vm.v_forks";
+       static const char       *vname = "vm.stats.vm.v_vforks";
+       static const char       *rname = "vm.stats.vm.v_rforks";
+
+       /* check if vm.stats.vm.v_forks is available */
+       if (gk_sysctlnametomib(name, oid_v_forks, &oid_v_forks_len) < 0)
+               return FALSE;
+       if (gk_sysctlnametomib(vname, oid_v_vforks, &oid_v_vforks_len) < 0)
+               return FALSE;
+       if (gk_sysctlnametomib(rname, oid_v_rforks, &oid_v_rforks_len) < 0)
+               return FALSE;
+       return TRUE;
+       }
+
+void
+gkrellm_sys_proc_read_data(void)
+       {
+       static int      oid_proc[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
+       double          avenrun;
+       u_int           n_forks, n_vforks, n_rforks, n_processes;
+       int             r_forks, r_vforks, r_rforks;
+       size_t          len;
+
+       if (getloadavg(&avenrun, 1) <= 0)
+               avenrun = 0;
+
+       /* We don't want to just use sysctlbyname().  Because,
+             * we call it so often. */
+       len = sizeof(n_forks);
+       r_forks = sysctl(oid_v_forks, oid_v_forks_len,
+                        &n_forks, &len, NULL, 0);
+       len = sizeof(n_vforks);
+       r_vforks = sysctl(oid_v_vforks, oid_v_vforks_len,
+                         &n_vforks, &len, NULL, 0);
+       len = sizeof(n_rforks);
+       r_rforks = sysctl(oid_v_rforks, oid_v_rforks_len,
+                         &n_rforks, &len, NULL, 0);
+       if (r_forks >= 0 && r_vforks >= 0 && r_rforks >= 0)
+               n_forks = n_forks + n_vforks + n_rforks;
+       else
+               n_forks = 0;
+
+       if (sysctl(oid_proc, 3, NULL, &len, NULL, 0) >= 0)
+               n_processes = len / sizeof(struct kinfo_proc);
+       else
+               n_processes = 0;
+       gkrellm_proc_assign_data(n_processes, 0, n_forks, avenrun);
+       }
+
+void
+gkrellm_sys_proc_read_users(void)
+       {
+       gint            n_users;
+       struct stat     sb, s;
+       gchar           ttybuf[MAXPATHLEN];
+       FILE            *ut;
+       struct utmp     utmp;
+       static time_t   utmp_mtime;
+
+       if (stat(_PATH_UTMP, &s) != 0 || s.st_mtime == utmp_mtime)
+               return;
+       if ((ut = fopen(_PATH_UTMP, "r")) != NULL)
+               {
+               n_users = 0;
+               while (fread(&utmp, sizeof(utmp), 1, ut))
+                       {
+                       if (utmp.ut_name[0] == '\0')
+                               continue;
+                       (void)snprintf(ttybuf, sizeof(ttybuf), "%s/%s",
+                                      _PATH_DEV, utmp.ut_line);
+                       /* corrupted record */
+                       if (stat(ttybuf, &sb))
+                               continue;
+                       ++n_users;
+                       }
+               (void)fclose(ut);
+               gkrellm_proc_assign_users(n_users);
+               }
+       utmp_mtime = s.st_mtime;
+       }
+
+
+/* ===================================================================== */
+/* Disk monitor interface */
+
+#include <devstat.h>
+static struct statinfo statinfo_cur;
+



Home | Main Index | Thread Index | Old Index