pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/xfce4-taskmanager xfce4-taskmanager: Update t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/766c252e7b15
branches:  trunk
changeset: 328429:766c252e7b15
user:      youri <youri%pkgsrc.org@localhost>
date:      Sun Jan 20 21:28:45 2019 +0000

description:
xfce4-taskmanager: Update to 1.2.2:

Notable changes:
- Switch to gtk3, disable gtk2 version
- Maintain NetBSD as a separate file until
  changes are upstreamed
- Various bug fixes and translations updates

diffstat:

 sysutils/xfce4-taskmanager/Makefile                             |   12 +-
 sysutils/xfce4-taskmanager/PLIST                                |    4 +-
 sysutils/xfce4-taskmanager/distinfo                             |   11 +-
 sysutils/xfce4-taskmanager/files/task-manager-netbsd.c          |  203 ++++
 sysutils/xfce4-taskmanager/patches/patch-src_task-manager-bsd.c |  450 ----------
 5 files changed, 218 insertions(+), 462 deletions(-)

diffs (truncated from 719 to 300 lines):

diff -r 5edd0afeaae5 -r 766c252e7b15 sysutils/xfce4-taskmanager/Makefile
--- a/sysutils/xfce4-taskmanager/Makefile       Sun Jan 20 20:10:47 2019 +0000
+++ b/sysutils/xfce4-taskmanager/Makefile       Sun Jan 20 21:28:45 2019 +0000
@@ -1,9 +1,8 @@
-# $NetBSD: Makefile,v 1.14 2018/11/14 22:22:29 kleink Exp $
+# $NetBSD: Makefile,v 1.15 2019/01/20 21:28:45 youri Exp $
 
-PKGREVISION= 6
 .include "../../meta-pkgs/xfce4/Makefile.common"
 
-DISTNAME=      xfce4-taskmanager-1.2.0
+DISTNAME=      xfce4-taskmanager-1.2.2
 CATEGORIES=    sysutils
 MASTER_SITES=  http://archive.xfce.org/src/apps/xfce4-taskmanager/1.2/
 
@@ -16,7 +15,12 @@
 LDFLAGS+=      -lkvm
 .endif
 
-.include "../../x11/gtk2/buildlink3.mk"
+CONFIGURE_ARGS+=       --disable-gtk2
+.if ${OPSYS} == "NetBSD"
+pre-configure:
+       ${CP} ${FILESDIR}/task-manager-netbsd.c ${WRKSRC}/src/task-manager-bsd.c
+.endif
+
 .include "../../x11/libXmu/buildlink3.mk"
 .include "../../x11/libxfce4ui/buildlink3.mk"
 .include "../../sysutils/desktop-file-utils/desktopdb.mk"
diff -r 5edd0afeaae5 -r 766c252e7b15 sysutils/xfce4-taskmanager/PLIST
--- a/sysutils/xfce4-taskmanager/PLIST  Sun Jan 20 20:10:47 2019 +0000
+++ b/sysutils/xfce4-taskmanager/PLIST  Sun Jan 20 21:28:45 2019 +0000
@@ -1,7 +1,7 @@
-@comment $NetBSD: PLIST,v 1.2 2017/06/18 23:22:27 youri Exp $
+@comment $NetBSD: PLIST,v 1.3 2019/01/20 21:28:45 youri Exp $
 bin/xfce4-taskmanager
 share/applications/xfce4-taskmanager.desktop
-share/icons/hicolor/16x16/apps/xc_crosshair.png
+share/icons/hicolor/16x16/actions/xc_crosshair.png
 share/icons/hicolor/24x24/actions/xc_crosshair.png
 share/icons/hicolor/scalable/actions/xc_crosshair.svg
 share/locale/ar/LC_MESSAGES/xfce4-taskmanager.mo
diff -r 5edd0afeaae5 -r 766c252e7b15 sysutils/xfce4-taskmanager/distinfo
--- a/sysutils/xfce4-taskmanager/distinfo       Sun Jan 20 20:10:47 2019 +0000
+++ b/sysutils/xfce4-taskmanager/distinfo       Sun Jan 20 21:28:45 2019 +0000
@@ -1,7 +1,6 @@
-$NetBSD: distinfo,v 1.4 2017/06/18 23:22:27 youri Exp $
+$NetBSD: distinfo,v 1.5 2019/01/20 21:28:45 youri Exp $
 
-SHA1 (xfce4-taskmanager-1.2.0.tar.bz2) = f1b0bbae1a706951a714b8b1d0de175894c75d60
-RMD160 (xfce4-taskmanager-1.2.0.tar.bz2) = 9205dc4e1d0e6a37066ef6fb1ae0c9696312caa3
-SHA512 (xfce4-taskmanager-1.2.0.tar.bz2) = 45a496dc406eb825b9829a9cd0b76250566df0bf57dd39413112512209936b52cd3271fd1933dd972582178d897ef40ab8e106b2980db6963d29373940fdcc2d
-Size (xfce4-taskmanager-1.2.0.tar.bz2) = 435276 bytes
-SHA1 (patch-src_task-manager-bsd.c) = fa644f8e6df7f43c2114c937eef50e08fd2939ce
+SHA1 (xfce4-taskmanager-1.2.2.tar.bz2) = 7e65f0d77ec6f5f7a82bacd89b9cf089d9ef355c
+RMD160 (xfce4-taskmanager-1.2.2.tar.bz2) = 14aba76c4c8d7de5fad60164219821342a9ee100
+SHA512 (xfce4-taskmanager-1.2.2.tar.bz2) = 670e8fd09bdaa85dc822dd5a7b055f898941e8079315843344e4dae12e2c0a14049b58241fb58f170461e7b8829bc479bea1a488b756210ef91ef8a4d7ff3348
+Size (xfce4-taskmanager-1.2.2.tar.bz2) = 395320 bytes
diff -r 5edd0afeaae5 -r 766c252e7b15 sysutils/xfce4-taskmanager/files/task-manager-netbsd.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xfce4-taskmanager/files/task-manager-netbsd.c    Sun Jan 20 21:28:45 2019 +0000
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2008-2014 Landry Breuil <landry%xfce.org@localhost>
+ *
+ * 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 Library 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 Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include <err.h>
+#include <sys/types.h>
+/* for sysctl() */
+#include <sys/param.h>
+#include <sys/sched.h>
+#include <sys/sysctl.h>
+/* for swapctl() */
+#include <sys/swap.h>
+/* for strlcpy() */
+#include <string.h>
+/* for getpagesize() */
+#include <unistd.h>
+/* for P_ZOMBIE & SSLEEP */
+#include <sys/proc.h>
+/* for struct vmtotal */
+#include <sys/vmmeter.h>
+#include "task-manager.h"
+
+#define _KMEMUSER
+#include <kvm.h>
+
+#include <errno.h>
+
+char   *state_abbrev[] = {
+       "", "start", "run", "sleep", "stop", "zomb", "dead", "onproc"
+};
+
+gboolean get_task_list (GArray *task_list)
+{
+       Task t;
+       struct kinfo_proc2 *kp, p;
+       char **args;
+       gchar* buf;
+       int i, nproc = 0;
+
+        char errbuf[_POSIX2_LINE_MAX];
+        kvm_t *kdp = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
+        if (kdp == NULL)
+                errx(1, "%s", errbuf);
+
+        if (!(kp = kvm_getproc2(kdp, KERN_PROC_ALL, 0,
+                    sizeof(struct kinfo_proc2), &nproc)))
+                err(1, "%s", kvm_geterr(kdp));
+
+        for (i = 0; i < nproc; i++) {
+               if (kp[i].p_pid < 1)
+                       continue; /* not valid */
+               
+               p = kp[i];
+               t.pid = p.p_pid;
+               t.ppid = p.p_ppid;
+               t.uid = p.p_uid;
+               t.prio = p.p_priority - PZERO;
+               t.vsz = p.p_vm_dsize + p.p_vm_ssize + p.p_vm_tsize;
+               t.vsz *= getpagesize();
+               t.rss = p.p_vm_rssize * getpagesize();
+               g_snprintf(t.state, sizeof(t.state), "%s", state_abbrev[p.p_stat]);
+               g_strlcpy(t.name, p.p_comm, strlen(p.p_comm) + 1);
+
+               if (!(p.p_stat == SDEAD)) {
+                       args = kvm_getargv2(kdp, &kp[i], BUFSIZ);
+                       if (args != NULL) {
+                               buf = g_strjoinv(" ", args);
+                               g_strlcpy(t.cmdline, buf, sizeof(t.cmdline));
+                       }
+                       t.cpu_user = (100.0f * ((gfloat) p.p_pctcpu / FSCALE));
+                       t.cpu_system = 0.0f; /* XXX TODO */
+                       g_array_append_val(task_list, t);
+               }
+       }
+       
+       g_free(args);
+       g_free(buf);
+       g_free(kp);
+
+       g_array_sort (task_list, task_pid_compare_fn);
+
+       return TRUE;
+}
+
+gboolean
+pid_is_sleeping (GPid pid)
+{
+       int mib[6];
+       struct kinfo_proc2 kp;
+       size_t size = sizeof(struct kinfo_proc2);
+
+       mib[0] = CTL_KERN;
+       mib[1] = KERN_PROC2;
+       mib[2] = KERN_PROC_PID;
+       mib[3] = pid;
+       mib[4] = size;
+       mib[5] = 1;
+       if (sysctl(mib, 6, &kp, &size, NULL, 0) < 0)
+               errx(1, "could not read kern.proc2 for pid %d", pid);
+       return (kp.p_stat == SSTOP ? TRUE : FALSE);
+}
+
+gboolean get_cpu_usage (gushort *cpu_count, gfloat *cpu_user, gfloat *cpu_system)
+{
+       size_t len = sizeof(*cpu_count);
+       sysctlbyname("hw.ncpu", cpu_count, &len, NULL, 0);
+
+       static gulong cp_user_old = 0, cp_system_old = 0, cp_total_old = 0;
+       static gulong cp_user = 0, cp_system = 0, cp_total = 0;
+
+       glong cpu_state[CPUSTATES] = { 0 };
+       len = sizeof(cpu_state);
+       sysctlbyname("kern.cp_time", &cpu_state, &len, NULL, 0);
+
+       cp_user_old = cp_user;
+       cp_system_old = cp_system;
+       cp_total_old = cp_total;
+       cp_user = cpu_state[CP_USER] + cpu_state[CP_NICE];
+       cp_system = cpu_state[CP_SYS] + cpu_state[CP_INTR];
+       cp_total = cpu_state[CP_IDLE] + cp_user + cp_system;
+
+       *cpu_user = *cpu_system = 0.0f;
+       if (cp_total > cp_total_old)
+       {
+               *cpu_user = (((cp_user - cp_user_old) * 100.0f) / (float)(cp_total - cp_total_old));
+               *cpu_system = (((cp_system - cp_system_old) * 100.0f) / (float)(cp_total - cp_total_old));
+       }
+
+       return TRUE;
+}
+
+/* vmtotal values in #pg */
+#define pagetok(nb) ((nb) * (getpagesize()))
+
+gboolean get_memory_usage (guint64 *memory_total, guint64 *memory_free,
+               guint64 *memory_cache, guint64 *memory_buffers,
+               guint64 *swap_total, guint64 *swap_free)
+{
+       int mib[] = {CTL_VM, VM_METER};
+       struct vmtotal vmtotal;
+       struct swapent *swdev;
+       int nswap, i;
+       size_t size;
+
+       size = sizeof(vmtotal);
+       if (sysctl(mib, 2, &vmtotal, &size, NULL, 0) < 0)
+               errx(1,"failed to get vm.meter");
+
+       mib[0] = CTL_HW;
+       mib[1] = HW_PHYSMEM64;
+       uint64_t physmem;
+       size_t physmemlen = sizeof(physmem);
+
+       if (sysctl(mib, 2, &physmem, &physmemlen, NULL, 0) < 0)
+               errx(1, "failed to get physmem");
+
+       *memory_total = (guint64)physmem;
+       *memory_free = pagetok((guint64)vmtotal.t_free);
+       *memory_cache = 0;
+       *memory_buffers = pagetok(vmtotal.t_rm - vmtotal.t_arm);
+
+       /* get swap stats */
+       if ((nswap = swapctl(SWAP_NSWAP, 0, 0)) == 0)
+               errx(1,"failed to get swap device count");
+
+       if ((swdev = calloc(nswap, sizeof(*swdev))) == NULL)
+               errx(1,"failed to allocate memory for swdev structures");
+
+       if (swapctl(SWAP_STATS, swdev, nswap) == -1) {
+               free(swdev);
+               errx(1,"failed to get swap stats");
+       }
+
+       /* Total things up */
+       *swap_total = *swap_free = 0;
+       for (i = 0; i < nswap; i++) {
+               if (swdev[i].se_flags & SWF_ENABLE) {
+                       *swap_free += (swdev[i].se_nblks - swdev[i].se_inuse);
+                       *swap_total += swdev[i].se_nblks;
+               }
+       }
+       *swap_total *= DEV_BSIZE;
+       *swap_free *= DEV_BSIZE;
+       free(swdev);
+
+       return TRUE;
+}
+
diff -r 5edd0afeaae5 -r 766c252e7b15 sysutils/xfce4-taskmanager/patches/patch-src_task-manager-bsd.c
--- a/sysutils/xfce4-taskmanager/patches/patch-src_task-manager-bsd.c   Sun Jan 20 20:10:47 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,450 +0,0 @@
-$NetBSD: patch-src_task-manager-bsd.c,v 1.3 2017/06/18 23:22:27 youri Exp $
-
-Attempt to bring netbsd, DragonFly while keeping OpenBSD support.
-
---- src/task-manager-bsd.c.orig        2014-12-23 21:40:14.000000000 +0100
-+++ src/task-manager-bsd.c     2016-01-28 13:44:44.128899084 +0100
-@@ -16,6 +16,7 @@
-  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-  */
- 
-+#define _KMEMUSER     /* NetBSD hides many types for regular userland */
- #include <stdlib.h>
- #include <err.h>
- /* for getpwuid() */
-@@ -25,8 +26,18 @@
- #include <sys/param.h>
- #include <sys/sched.h>
- #include <sys/sysctl.h>
-+
-+#ifdef __DragonFly__
-+#include <sys/kinfo.h>
-+#include <sys/resource.h>
-+#include <vm/vm_param.h>
-+#else
- /* for swapctl() */
- #include <sys/swap.h>
-+#include <uvm/uvm_extern.h>
-+#endif
-+
-+#include <kvm.h>
- /* for strlcpy() */



Home | Main Index | Thread Index | Old Index