pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/top I forgot to add Christos's patches for Ne...
details: https://anonhg.NetBSD.org/pkgsrc/rev/68644f116a66
branches: trunk
changeset: 477918:68644f116a66
user: cube <cube%pkgsrc.org@localhost>
date: Sun Jul 11 20:54:16 2004 +0000
description:
I forgot to add Christos's patches for NetBSD support...
diffstat:
sysutils/top/distinfo | 5 +-
sysutils/top/patches/patch-aj | 15 +
sysutils/top/patches/patch-ak | 15 +
sysutils/top/patches/patch-al | 893 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 927 insertions(+), 1 deletions(-)
diffs (truncated from 947 to 300 lines):
diff -r 783e1677b363 -r 68644f116a66 sysutils/top/distinfo
--- a/sysutils/top/distinfo Sun Jul 11 19:54:22 2004 +0000
+++ b/sysutils/top/distinfo Sun Jul 11 20:54:16 2004 +0000
@@ -1,4 +1,7 @@
-$NetBSD: distinfo,v 1.5 2004/07/11 19:53:06 cube Exp $
+$NetBSD: distinfo,v 1.6 2004/07/11 20:54:16 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
diff -r 783e1677b363 -r 68644f116a66 sysutils/top/patches/patch-aj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/top/patches/patch-aj Sun Jul 11 20:54:16 2004 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-aj,v 1.1 2004/07/11 20:54:16 cube Exp $
+
+--- configure.ac.orig 2004-04-21 03:55:36.000000000 +0000
++++ configure.ac
+@@ -116,6 +116,10 @@ else
+ dec-osf*) MODULE=decosf1;;
+ osf1*) MODULE=decosf1;;
+ freebsd*) MODULE=freebsd;;
++ netbsd0*) MODULE=netbsd08;;
++ netbsd10) MODULE=netbsd10;;
++ netbsd13*) MODULE=netbsd132;;
++ netbsd*) MODULE=netbsd15;;
+ hpux7*) MODULE=hpux7;;
+ hpux8*) MODULE=hpux8;;
+ hpux9*) MODULE=hpux9;;
diff -r 783e1677b363 -r 68644f116a66 sysutils/top/patches/patch-ak
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/top/patches/patch-ak Sun Jul 11 20:54:16 2004 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-ak,v 1.1 2004/07/11 20:54:16 cube Exp $
+
+--- configure.orig 2004-04-21 04:02:42.000000000 +0000
++++ configure
+@@ -3470,6 +3470,10 @@ else
+ dec-osf*) MODULE=decosf1;;
+ osf1*) MODULE=decosf1;;
+ freebsd*) MODULE=freebsd;;
++ netbsd0*) MODULE=netbsd08;;
++ netbsd10) MODULE=netbsd10;;
++ netbsd13*) MODULE=netbsd132;;
++ netbsd*) MODULE=netbsd15;;
+ hpux7*) MODULE=hpux7;;
+ hpux8*) MODULE=hpux8;;
+ hpux9*) MODULE=hpux9;;
diff -r 783e1677b363 -r 68644f116a66 sysutils/top/patches/patch-al
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/top/patches/patch-al Sun Jul 11 20:54:16 2004 +0000
@@ -0,0 +1,893 @@
+$NetBSD: patch-al,v 1.1 2004/07/11 20:54:16 cube Exp $
+
+--- machine/m_netbsd15.c.orig 2004-07-11 21:31:15.000000000 +0000
++++ machine/m_netbsd15.c
+@@ -0,0 +1,888 @@
++/* NetBSD: m_netbsd15.c,v 1.22 2004/02/13 11:36:24 wiz Exp */
++
++/*
++ * top - a top users display for Unix
++ *
++ * SYNOPSIS: For a NetBSD-1.5 (or later) system
++ *
++ * DESCRIPTION:
++ * Originally written for BSD4.4 system by Christos Zoulas.
++ * Based on the FreeBSD 2.0 version by Steven Wallace and Wolfram Schneider.
++ * NetBSD-1.0 port by Arne Helme. Process ordering by Luke Mewburn.
++ * 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
++ * and should work for:
++ * NetBSD-2.0 (when released)
++ * -
++ * top does not need to be installed setuid or setgid with this module.
++ *
++ * LIBS: -lkvm
++ *
++ * CFLAGS: -DHAVE_GETOPT -DORDER -DHAVE_STRERROR
++ *
++ * AUTHORS: Christos Zoulas <christos%ee.cornell.edu@localhost>
++ * 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>
++ * matthew green <mrg%eterna.com.au@localhost>
++ * Simon Burge <simonb%NetBSD.org@localhost>
++ * Tomas Svensson <ts%unix1.net@localhost>
++ *
++ *
++ * Id: m_netbsd15.c,v 1.22 2004/02/13 11:36:24 wiz 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>
++#include <sys/sched.h>
++#include <sys/swap.h>
++
++#include <uvm/uvm_extern.h>
++
++#include <err.h>
++#include <errno.h>
++#include <kvm.h>
++#include <math.h>
++#include <nlist.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++
++#include "os.h"
++#include "top.h"
++#include "machine.h"
++#include "utils.h"
++#include "display.h"
++#include "loadavg.h"
++
++void percentages64 __P((int, int *, u_int64_t *, u_int64_t *, u_int64_t *));
++
++
++/* get_process_info passes back a handle. This is what it looks like: */
++
++struct handle {
++ struct kinfo_proc2 **next_proc; /* points to next valid proc pointer */
++ int remaining; /* number of pointers remaining */
++};
++
++/* define what weighted CPU is. */
++#define weighted_cpu(pct, pp) ((pp)->p_swtime == 0 ? 0.0 : \
++ ((pct) / (1.0 - exp((pp)->p_swtime * logcpu))))
++
++/* what we consider to be process size: */
++#define PROCSIZE(pp) \
++ ((pp)->p_vm_tsize + (pp)->p_vm_dsize + (pp)->p_vm_ssize)
++
++
++/*
++ * These definitions control the format of the per-process area
++ */
++
++static char header[] =
++ " PID X PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND";
++/* 0123456 -- field to fill in starts at header+6 */
++#define UNAME_START 6
++
++#define Proc_format \
++ "%5d %-8.8s %3d %4d%7s %5s %-8.8s%7s %5.2f%% %5.2f%% %.12s"
++
++
++/*
++ * Process state names for the "STATE" column of the display.
++ */
++
++const char *state_abbrev[] = {
++ "", "START", "RUN", "SLEEP", "STOP", "ZOMB", "DEAD", "CPU"
++};
++
++static kvm_t *kd;
++
++/* these are retrieved from the kernel in _init */
++
++static double logcpu;
++static int hz;
++static int ccpu;
++
++/* 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;
++
++/* these are for detailing the process states */
++
++int process_states[8];
++char *procstatenames[] = {
++ "", " starting, ", " runnable, ", " sleeping, ", " stopped, ",
++ " zombie, ", " dead, ", " on processor, ",
++ NULL
++};
++
++/* these are for detailing the CPU states */
++
++int *cpu_states;
++char *cpustatenames[] = {
++ "user", "nice", "system", "interrupt", "idle", NULL
++};
++
++/* these are for detailing the memory statistics */
++
++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, ",
++ NULL
++};
++
++
++/* these are names given to allowed sorting orders -- first is default */
++char *ordernames[] = {
++ "cpu",
++ "pri",
++ "res",
++ "size",
++ "state",
++ "time",
++ NULL
++};
++
++/* forward definitions for comparison functions */
++static int compare_cpu __P((struct proc **, struct proc **));
++static int compare_prio __P((struct proc **, struct proc **));
++static int compare_res __P((struct proc **, struct proc **));
++static int compare_size __P((struct proc **, struct proc **));
++static int compare_state __P((struct proc **, struct proc **));
++static int compare_time __P((struct proc **, struct proc **));
++
++int (*proc_compares[]) __P((struct proc **, struct proc **)) = {
++ compare_cpu,
++ compare_size,
++ compare_res,
++ compare_time,
++ compare_prio,
++ compare_state,
++ NULL
++};
++
++
++/* these are for keeping track of the proc array */
++
++static int nproc;
++static int onproc = -1;
++static int pref_len;
++static struct kinfo_proc2 *pbase;
++static struct kinfo_proc2 **pref;
++
++/* these are for getting the memory statistics */
++
++static int pageshift; /* log base 2 of the pagesize */
++
++/* define pagetok in terms of pageshift */
++
++#define pagetok(size) ((size) << pageshift)
++
++int
++machine_init(statics)
++ struct statics *statics;
++{
++ int pagesize;
++ int mib[2];
++ size_t size;
++ struct clockinfo clockinfo;
++
++ 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) {
Home |
Main Index |
Thread Index |
Old Index