pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/top Make this work on netbsd-1-6, and probabl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9877a8f3819f
branches:  trunk
changeset: 477923:9877a8f3819f
user:      cube <cube%pkgsrc.org@localhost>
date:      Mon Jul 12 08:14:44 2004 +0000

description:
Make this work on netbsd-1-6, and probably netbsd-1-5.  It will break on
earlier versions, but we don't support them in pkgsrc anyway.  The reason
for this is that the configure script uses ac_cv_target, but we don't pass
a version number in there.
The workaround I use is gross, I know.  Oh, well, that won't prevent me
from sleeping well at night.
Final fix for 26249.

diffstat:

 sysutils/top/distinfo                |   10 +-
 sysutils/top/files/defaults.netbsd13 |   19 -
 sysutils/top/files/defaults.sunos5   |   19 -
 sysutils/top/patches/patch-aj        |    4 +-
 sysutils/top/patches/patch-ak        |    4 +-
 sysutils/top/patches/patch-al        |  177 ++----
 sysutils/top/patches/patch-am        |  842 ++++++++++++++++++++++++++++++++
 sysutils/top/patches/patch-an        |  900 +++++++++++++++++++++++++++++++++++
 8 files changed, 1804 insertions(+), 171 deletions(-)

diffs (truncated from 2254 to 300 lines):

diff -r 321d1c4b6fc3 -r 9877a8f3819f sysutils/top/distinfo
--- a/sysutils/top/distinfo     Mon Jul 12 07:21:38 2004 +0000
+++ b/sysutils/top/distinfo     Mon Jul 12 08:14:44 2004 +0000
@@ -1,7 +1,9 @@
-$NetBSD: distinfo,v 1.6 2004/07/11 20:54:16 cube Exp $
+$NetBSD: distinfo,v 1.7 2004/07/12 08:14:44 cube Exp $
 
 SHA1 (top-3.6alpha7.tar.gz) = b0336ddc2482b6a52f5345855bf46e0de7d8438a
 Size (top-3.6alpha7.tar.gz) = 295433 bytes
-SHA1 (patch-aj) = 069880d4a33efc63d055168ce7b9a3d215be0aa4
-SHA1 (patch-ak) = 4879f01bc091425c41d6768e171b2cf085674561
-SHA1 (patch-al) = d89f617d6e9e84ceaec249c602e67612473d0306
+SHA1 (patch-aj) = 0a15ee8d2581e6150bfdc6c893971147d30cb914
+SHA1 (patch-ak) = 899d1263df15d8389c9391d173369141170ab7ea
+SHA1 (patch-al) = e9619f30350d9357a2a20a1d509a69eadf2b287e
+SHA1 (patch-am) = 18495242954b15f57c14779c8e7d67d73be2b60b
+SHA1 (patch-an) = 1208da5f80daacbd68310033ac814c146d58d185
diff -r 321d1c4b6fc3 -r 9877a8f3819f sysutils/top/files/defaults.netbsd13
--- a/sysutils/top/files/defaults.netbsd13      Mon Jul 12 07:21:38 2004 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-set module = 'netbsd13'
-set LoadMax = '5.0'
-set topn = '-1'
-set NominalTopn = '18'
-set delay = '2'
-set owner = 'root'
-set group = 'kmem'
-set mode = '2755'
-set random = '1'
-set TableSize = '47'
-set bindir = '$(PREFIX)/bin'
-set mandir = '$(PREFIX)/man/man1'
-set manext = '1'
-set mansty = 'man'
-set Cmdshell = '/bin/sh'
-set Cmdcc = 'cc'
-set Cmdawk = 'awk'
-set Cmdinstall = '/usr/bin/install'
-set cdefs = '-DHAVE_GETOPT -O'
diff -r 321d1c4b6fc3 -r 9877a8f3819f sysutils/top/files/defaults.sunos5
--- a/sysutils/top/files/defaults.sunos5        Mon Jul 12 07:21:38 2004 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-set module = 'sunos5'
-set LoadMax = '5.0'
-set topn = '-1'
-set NominalTopn = '18'
-set delay = '2'
-set owner = 'root'
-set group = 'sys'
-set mode = '2755'
-set random = '1'
-set TableSize = '47'
-set bindir = '$(PREFIX)/bin'
-set mandir = '$(PREFIX)/man/man1'
-set manext = '1'
-set mansty = 'man'
-set Cmdshell = '/bin/sh'
-set Cmdcc = 'gcc'
-set Cmdawk = 'nawk'
-set Cmdinstall = '/usr/ucb/install'
-set cdefs = '-DHAVE_GETOPT -O'
diff -r 321d1c4b6fc3 -r 9877a8f3819f sysutils/top/patches/patch-aj
--- a/sysutils/top/patches/patch-aj     Mon Jul 12 07:21:38 2004 +0000
+++ b/sysutils/top/patches/patch-aj     Mon Jul 12 08:14:44 2004 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-aj,v 1.1 2004/07/11 20:54:16 cube Exp $
+$NetBSD: patch-aj,v 1.2 2004/07/12 08:14:44 cube Exp $
 
 --- configure.ac.orig  2004-04-21 03:55:36.000000000 +0000
 +++ configure.ac
@@ -9,7 +9,7 @@
 +        netbsd0*)     MODULE=netbsd08;;
 +        netbsd10)     MODULE=netbsd10;;
 +        netbsd13*)    MODULE=netbsd132;;
-+        netbsd*)      MODULE=netbsd15;;
++        netbsd*)      MODULE=netbsd20;;
        hpux7*)         MODULE=hpux7;;
        hpux8*)         MODULE=hpux8;;
        hpux9*)         MODULE=hpux9;;
diff -r 321d1c4b6fc3 -r 9877a8f3819f sysutils/top/patches/patch-ak
--- a/sysutils/top/patches/patch-ak     Mon Jul 12 07:21:38 2004 +0000
+++ b/sysutils/top/patches/patch-ak     Mon Jul 12 08:14:44 2004 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-ak,v 1.1 2004/07/11 20:54:16 cube Exp $
+$NetBSD: patch-ak,v 1.2 2004/07/12 08:14:44 cube Exp $
 
 --- configure.orig     2004-04-21 04:02:42.000000000 +0000
 +++ configure
@@ -9,7 +9,7 @@
 +        netbsd0*)     MODULE=netbsd08;;
 +        netbsd10)     MODULE=netbsd10;;
 +        netbsd13*)    MODULE=netbsd132;;
-+        netbsd*)      MODULE=netbsd15;;
++        netbsd*)      MODULE=netbsd20;;
        hpux7*)         MODULE=hpux7;;
        hpux8*)         MODULE=hpux8;;
        hpux9*)         MODULE=hpux9;;
diff -r 321d1c4b6fc3 -r 9877a8f3819f sysutils/top/patches/patch-al
--- a/sysutils/top/patches/patch-al     Mon Jul 12 07:21:38 2004 +0000
+++ b/sysutils/top/patches/patch-al     Mon Jul 12 08:14:44 2004 +0000
@@ -1,9 +1,9 @@
-$NetBSD: patch-al,v 1.1 2004/07/11 20:54:16 cube Exp $
+$NetBSD: patch-al,v 1.2 2004/07/12 08:14:44 cube Exp $
 
---- machine/m_netbsd15.c.orig  2004-07-11 21:31:15.000000000 +0000
+--- machine/m_netbsd15.c.orig  2004-07-12 09:09:49.000000000 +0200
 +++ machine/m_netbsd15.c
-@@ -0,0 +1,888 @@
-+/*    NetBSD: m_netbsd15.c,v 1.22 2004/02/13 11:36:24 wiz Exp         */
+@@ -0,0 +1,815 @@
++/*    NetBSD: m_netbsd15.c,v 1.7.2.2 2002/02/09 19:56:24 he Exp       */
 +
 +/*
 + * top - a top users display for Unix
@@ -17,13 +17,12 @@
 + * NetBSD-1.3 port by Luke Mewburn, based on code by Matthew Green.
 + * NetBSD-1.4/UVM port by matthew green.
 + * NetBSD-1.5 port by Simon Burge.
-+ * NetBSD-1.6/UBC port by Tomas Svensson.
 + * -
 + * This is the machine-dependent module for NetBSD-1.5 and later
 + * works for:
-+ *    NetBSD-1.6ZC
++ *    NetBSD-1.4Z
 + * and should work for:
-+ *    NetBSD-2.0      (when released)
++ *    NetBSD-1.5      (when released)
 + * -
 + * top does not need to be installed setuid or setgid with this module.
 + *
@@ -35,19 +34,13 @@
 + *            Steven Wallace <swallace%freebsd.org@localhost>
 + *            Wolfram Schneider <wosch%cs.tu-berlin.de@localhost>
 + *            Arne Helme <arne%acm.org@localhost>
-+ *            Luke Mewburn <lukem%NetBSD.org@localhost>
++ *            Luke Mewburn <lukem%netbsd.org@localhost>
 + *            matthew green <mrg%eterna.com.au@localhost>
-+ *            Simon Burge <simonb%NetBSD.org@localhost>
-+ *            Tomas Svensson <ts%unix1.net@localhost>
++ *            Simon Burge <simonb%netbsd.org@localhost>
 + *
 + *
-+ * Id: m_netbsd15.c,v 1.22 2004/02/13 11:36:24 wiz Exp 
++ * Id: m_netbsd15.c,v 1.7.2.2 2002/02/09 19:56:24 he Exp 
 + */
-+#include <sys/cdefs.h>
-+
-+#ifndef lint
-+__RCSID("NetBSD: m_netbsd15.c,v 1.22 2004/02/13 11:36:24 wiz Exp ");
-+#endif
 +
 +#include <sys/param.h>
 +#include <sys/sysctl.h>
@@ -83,7 +76,7 @@
 +      int remaining;          /* number of pointers remaining */
 +};
 +
-+/* define what weighted CPU is. */
++/* define what weighted cpu is. */
 +#define weighted_cpu(pct, pp) ((pp)->p_swtime == 0 ? 0.0 : \
 +                       ((pct) / (1.0 - exp((pp)->p_swtime * logcpu))))
 +
@@ -121,12 +114,11 @@
 +static int hz;
 +static int ccpu;
 +
-+/* these are for calculating CPU state percentages */
++/* these are for calculating cpu state percentages */
 +
-+static int ncpu = 0;
-+static u_int64_t *cp_time;
-+static u_int64_t *cp_old;
-+static u_int64_t *cp_diff;
++static u_int64_t cp_time[CPUSTATES];
++static u_int64_t cp_old[CPUSTATES];
++static u_int64_t cp_diff[CPUSTATES];
 +
 +/* these are for detailing the process states */
 +
@@ -137,9 +129,9 @@
 +      NULL
 +};
 +
-+/* these are for detailing the CPU states */
++/* these are for detailing the cpu states */
 +
-+int *cpu_states;
++int cpu_states[CPUSTATES];
 +char *cpustatenames[] = {
 +      "user", "nice", "system", "interrupt", "idle", NULL
 +};
@@ -148,14 +140,8 @@
 +
 +int memory_stats[7];
 +char *memorynames[] = {
-+      "K Act, ", "K Inact, ", "K Wired, ", "K Exec, ", "K File, ",
-+      "K Free, ",
-+      NULL
-+};
-+
-+int swap_stats[4];
-+char *swapnames[] = {
-+      "K Total, ", "K Used, ", "K Free, ",
++      "K Act, ", "K Inact, ", "K Wired, ", "K Free, ",
++      "K Swp, ", "K Swp free, ",
 +      NULL
 +};
 +
@@ -181,11 +167,11 @@
 +
 +int (*proc_compares[]) __P((struct proc **, struct proc **)) = {
 +      compare_cpu,
++      compare_prio,
++      compare_res,
 +      compare_size,
-+      compare_res,
++      compare_state,
 +      compare_time,
-+      compare_prio,
-+      compare_state,
 +      NULL
 +};
 +
@@ -218,37 +204,6 @@
 +      if ((kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open")) == NULL)
 +              return -1;
 +
-+      mib[0] = CTL_HW;
-+      mib[1] = HW_NCPU;
-+      size = sizeof(ncpu);
-+      if (sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) {
-+              fprintf(stderr, "top: sysctl hw.ncpu failed: %s\n",
-+                  strerror(errno));
-+              return(-1);
-+      }
-+      cp_time = malloc(sizeof(cp_time[0]) * CPUSTATES * ncpu);
-+      mib[0] = CTL_KERN;
-+      mib[1] = KERN_CP_TIME;
-+      size = sizeof(cp_time[0]) * CPUSTATES * ncpu;
-+      if (sysctl(mib, 2, cp_time, &size, NULL, 0) < 0) {
-+              fprintf(stderr, "top: sysctl kern.cp_time failed: %s\n",
-+                  strerror(errno));
-+              return(-1);
-+      }
-+      /* Handle old call that returned only aggregate */
-+      if (size == sizeof(cp_time[0]) * CPUSTATES)
-+              ncpu = 1;
-+
-+      cpu_states = malloc(sizeof(cpu_states[0]) * CPUSTATES * ncpu);
-+      cp_old = malloc(sizeof(cp_old[0]) * CPUSTATES * ncpu);
-+      cp_diff = malloc(sizeof(cp_diff[0]) * CPUSTATES * ncpu);
-+      if (cpu_states == NULL || cp_time == NULL || cp_old == NULL ||
-+          cp_diff == NULL) {
-+              fprintf(stderr, "top: machine_init: %s\n",
-+                  strerror(errno));
-+              return(-1);
-+      }
-+
 +      mib[0] = CTL_KERN;
 +      mib[1] = KERN_CCPU;
 +      size = sizeof(ccpu);
@@ -287,13 +242,9 @@
 +      pageshift -= LOG1024;
 +
 +      /* fill in the statics information */
-+#ifdef notyet
-+      statics->ncpu = ncpu;
-+#endif
 +      statics->procstate_names = procstatenames;
 +      statics->cpustate_names = cpustatenames;
 +      statics->memory_names = memorynames;
-+      statics->swap_names = swapnames;
 +      statics->order_names = ordernames;
 +
 +      /* all done! */
@@ -320,15 +271,15 @@
 +{
 +      size_t ssize;
 +      int mib[2];
-+      struct uvmexp_sysctl uvmexp;
++      struct uvmexp uvmexp;
 +      struct swapent *sep, *seporig;
 +      u_int64_t totalsize, totalinuse;
-+      int size, inuse, ncounted, i;
++      int size, inuse, ncounted;
 +      int rnswap, nswap;
 +
 +      mib[0] = CTL_KERN;
 +      mib[1] = KERN_CP_TIME;
-+      ssize = sizeof(cp_time[0]) * CPUSTATES * ncpu;
++      ssize = sizeof(cp_time);
 +      if (sysctl(mib, 2, cp_time, &ssize, NULL, 0) < 0) {
 +              fprintf(stderr, "top: sysctl kern.cp_time failed: %s\n",
 +                  strerror(errno));
@@ -344,17 +295,13 @@
 +      }
 +
 +      /* convert cp_time counts to percentages */



Home | Main Index | Thread Index | Old Index