Move "libgtop" package to "devel" category.

This commit is contained in:
tron 1998-11-01 23:21:46 +00:00
parent 07de54a218
commit c15f028dc4
34 changed files with 16 additions and 1053 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.3 1998/10/18 22:34:00 tron Exp $
# $NetBSD: Makefile,v 1.4 1998/11/01 23:21:46 tron Exp $
#
DISTNAME= libgtop-0.26.0

View file

@ -1,3 +1,3 @@
$NetBSD: md5,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: md5,v 1.2 1998/11/01 23:22:04 tron Exp $
MD5 (libgtop-0.26.0.tar.gz) = 9c8263b9c385954da1b75e7c5ae30734

View file

@ -1,4 +1,4 @@
$NetBSD: patch-aa,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-aa,v 1.2 1998/11/01 23:22:19 tron Exp $
Make sure we always use our own (pkglibtool) version of libtool on NetBSD.

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ab,v 1.2 1998/11/01 23:07:30 tron Exp $
$NetBSD: patch-ab,v 1.3 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/open.c.orig Mon Aug 24 20:14:49 1998
+++ sysdeps/bsd/open.c Sun Nov 1 23:40:07 1998

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ac,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-ac,v 1.2 1998/11/01 23:22:19 tron Exp $
<osreldate.h> is not available on NetBSD.

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ad,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-ad,v 1.2 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/mem.c 1998/10/06 16:43:47 1.1
+++ sysdeps/bsd/mem.c 1998/10/06 16:48:51

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ae,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-ae,v 1.2 1998/11/01 23:22:19 tron Exp $
Most of this file was taken from the xosview swapinternal.cc file.

View file

@ -1,4 +1,4 @@
$NetBSD: patch-af,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-af,v 1.2 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/shm_limits.c 1998/10/06 17:04:40 1.1
+++ sysdeps/bsd/shm_limits.c 1998/10/06 17:08:48

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ag,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-ag,v 1.2 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/msg_limits.c 1998/10/06 17:10:11 1.1
+++ sysdeps/bsd/msg_limits.c 1998/10/06 17:10:53

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ah,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-ah,v 1.2 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/sem_limits.c 1998/10/06 17:11:38 1.1
+++ sysdeps/bsd/sem_limits.c 1998/10/06 17:12:15

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ai,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-ai,v 1.2 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/procmem.c 1998/10/07 11:22:59 1.1
+++ sysdeps/bsd/procmem.c 1998/10/07 11:39:30

View file

@ -1,4 +1,4 @@
$NetBSD: patch-aj,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-aj,v 1.2 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/prockernel.c 1998/10/07 11:54:44 1.1
+++ sysdeps/bsd/prockernel.c 1998/10/07 12:01:57

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ak,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-ak,v 1.2 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/procmap.c 1998/10/07 12:03:03 1.1
+++ sysdeps/bsd/procmap.c 1998/10/07 12:09:41

View file

@ -1,4 +1,4 @@
$NetBSD: patch-al,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
$NetBSD: patch-al,v 1.2 1998/11/01 23:22:19 tron Exp $
--- Makefile.in 1998/10/07 12:44:49 1.1
+++ Makefile.in 1998/10/07 12:45:27

View file

@ -1,4 +1,4 @@
$NetBSD: patch-am,v 1.2 1998/11/01 23:07:31 tron Exp $
$NetBSD: patch-am,v 1.3 1998/11/01 23:22:19 tron Exp $
--- sysdeps/bsd/procsignal.c.orig Wed Sep 9 01:54:54 1998
+++ sysdeps/bsd/procsignal.c Sun Nov 1 23:20:05 1998

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.2 1998/10/18 22:31:00 tron Exp $
@comment $NetBSD: PLIST,v 1.3 1998/11/01 23:22:34 tron Exp $
bin/libgtop_daemon
bin/libgtop_server
bin/libgtop-config

View file

@ -1,30 +0,0 @@
# $NetBSD: Makefile,v 1.3 1998/10/18 22:34:00 tron Exp $
#
DISTNAME= libgtop-0.26.0
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.jimpick.com/pub/mirrors/gnome/sources/ \
ftp://ftp.gnome.org/pub/GNOME/sources/ \
ftp://ftp.geo.net/pub/gnome/sources/
MAINTAINER= packages@netbsd.org
HOMEPAGE= http://www.gnome.org/
DEPENDS+= gnome-libs-0.30.1:../../x11/gnome-libs
DEPENDS+= guile-1.2:../../lang/guile
DEPENDS+= gettext-0.10:../../misc/gettext
NOT_FOR_ARCHS= alpha # problems with gtk
GNU_CONFIGURE= yes
USE_GMAKE= yes
USE_LIBTOOL= yes
CONFIGURE_ARGS+= --with-glib-prefix=${LOCALBASE} \
--with-libgtop-guile --with-catgets
CONFIGURE_ENV+= LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
post-extract:
@${MV} ${WRKSRC}/sysdeps/freebsd ${WRKSRC}/sysdeps/bsd
.include "../../mk/bsd.pkg.mk"

View file

@ -1,3 +0,0 @@
$NetBSD: md5,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
MD5 (libgtop-0.26.0.tar.gz) = 9c8263b9c385954da1b75e7c5ae30734

View file

@ -1,126 +0,0 @@
$NetBSD: patch-aa,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
Make sure we always use our own (pkglibtool) version of libtool on NetBSD.
Generalise the freebsd directory to be bsd.
--- configure 1998/10/05 15:33:19 1.1
+++ configure 1998/10/05 15:34:46
@@ -1934,7 +1934,8 @@
-# Always use our own libtool.
+# Always use our own libtool for NetBSD.
+if false; then
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -2014,6 +2015,7 @@
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+fi
@@ -3263,7 +3265,12 @@
libgtop_need_server=yes
;;
freebsd*)
- libgtop_sysdeps_dir=freebsd
+ libgtop_sysdeps_dir=bsd
+ libgtop_use_machine_h=yes
+ libgtop_need_server=yes
+ ;;
+ netbsd*)
+ libgtop_sysdeps_dir=bsd
libgtop_use_machine_h=yes
libgtop_need_server=yes
;;
@@ -3381,7 +3388,7 @@
saved_ldflags="$LDFLAGS"
- saved_cppflags="$CPPFLAGS"
+ saved_cppflags="$CPPFLAGS -I$LOCALBASE/include"
LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
echo $ac_n "checking for main in -lqthreads""... $ac_c" 1>&6
@@ -3847,7 +3854,7 @@
LDFLAGS="$saved_ldflags $GUILE_LIBS"
- CPPFLAGS="$saved_cppflags $GUILE_INCS"
+ CPPFLAGS="$saved_cppflags $GUILE_INCS -I$LOCALBASE/include"
echo $ac_n "checking whether guile works""... $ac_c" 1>&6
echo "configure:3854: checking whether guile works" >&5
@@ -3895,7 +3902,7 @@
fi
LDFLAGS="$saved_ldflags"
- CPPFLAGS="$saved_cppflags"
+ CPPFLAGS="$saved_cppflags -I$LOCALBASE/include"
@@ -4073,6 +4080,7 @@
+if false; then
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -4153,6 +4161,7 @@
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+fi
@@ -7722,6 +7731,9 @@
freebsd*)
fu_cv_sys_stat_statfs2_bsize=yes
;;
+ netbsd*)
+ fu_cv_sys_stat_statfs2_bsize=yes
+ ;;
osf*)
fu_cv_sys_stat_statfs3_osf1=yes
;;
@@ -8882,7 +8894,7 @@
sysdeps/osf1/Makefile
sysdeps/linux/Makefile
sysdeps/kernel/Makefile
-sysdeps/freebsd/Makefile
+sysdeps/bsd/Makefile
src/Makefile
src/daemon/Makefile
src/inodedb/Makefile
@@ -9107,7 +9119,7 @@
sysdeps/osf1/Makefile
sysdeps/linux/Makefile
sysdeps/kernel/Makefile
-sysdeps/freebsd/Makefile
+sysdeps/bsd/Makefile
src/Makefile
src/daemon/Makefile
src/inodedb/Makefile
@@ -9151,10 +9163,10 @@
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
+# case "$ac_given_INSTALL" in
+# [/$]*) INSTALL="$ac_given_INSTALL" ;;
+# *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+# esac
echo creating "$ac_file"
rm -f "$ac_file"

View file

@ -1,20 +0,0 @@
$NetBSD: patch-ab,v 1.2 1998/11/01 23:07:30 tron Exp $
--- sysdeps/bsd/open.c.orig Mon Aug 24 20:14:49 1998
+++ sysdeps/bsd/open.c Sun Nov 1 23:40:07 1998
@@ -61,7 +61,15 @@
server->machine.gid = getgid ();
server->machine.egid = getegid ();
+#ifdef __NetBSD__
+#ifdef __NetBSD_Version__
+ server->os_version_code = __NetBSD_Version__;
+#else
+ server->os_version_code = 103000000;
+#endif
+#else
server->os_version_code = __FreeBSD_version;
+#endif
/* Setup machine-specific data */
server->machine.kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "kvm_open");

View file

@ -1,17 +0,0 @@
$NetBSD: patch-ac,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
<osreldate.h> is not available on NetBSD.
--- sysdeps/bsd/glibtop_machine.h 1998/10/06 16:21:44 1.1
+++ sysdeps/bsd/glibtop_machine.h 1998/10/06 16:21:49
@@ -31,7 +31,10 @@
#include <sys/sysctl.h>
#include <fcntl.h>
+
+#ifdef __FreeBSD__
#include <osreldate.h>
+#endif
__BEGIN_DECLS

View file

@ -1,24 +0,0 @@
$NetBSD: patch-ad,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- sysdeps/bsd/mem.c 1998/10/06 16:43:47 1.1
+++ sysdeps/bsd/mem.c 1998/10/06 16:48:51
@@ -116,11 +116,19 @@
/* convert memory stats to Kbytes */
+#ifdef __NetBSD__
+ buf->total = (u_int64_t) pagetok (vmm.v_kernel_pages) << LOG1024;
+#else
buf->total = (u_int64_t) pagetok (vmm.v_page_count) << LOG1024;
+#endif
buf->used = (u_int64_t) pagetok (vmm.v_active_count) << LOG1024;
buf->free = (u_int64_t) pagetok (vmm.v_free_count) << LOG1024;
+#ifdef __NetBSD__
+ buf->cached = (u_int64_t) pagetok (vmm.v_wire_count) << LOG1024;
+#else
buf->cached = (u_int64_t) pagetok (vmm.v_cache_count) << LOG1024;
+#endif
buf->shared = (u_int64_t) pagetok (vmt.t_vmshr) << LOG1024;
buf->buffer = (u_int64_t) bufspace;

View file

@ -1,483 +0,0 @@
$NetBSD: patch-ae,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
Most of this file was taken from the xosview swapinternal.cc file.
--- sysdeps/bsd/swap.c 1998/10/06 16:52:26 1.1
+++ sysdeps/bsd/swap.c 1998/10/06 17:02:58
@@ -19,6 +19,54 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+/* Copyright (c) 1995 by Brian Grayson (bgrayson@ece.utexas.edu)
+ *
+ * This code is borrowed HEAVILY from the vmstat source code in the
+ * NetBSD distribution. As such, the NetBSD copyright claim/disclaimer
+ * applies to most of this code. The disclaimer, along with the CVS
+ * header from the version from which this file was created, are included
+ * below:
+ *
+ * Id: swapinternal.cc,v 1.15 1998/05/17 21:34:06 bgrayson Exp
+ *
+ * NOTE THAT THIS FILE IS UNDER THE BSD COPYRIGHT, AND NOT GPL!
+ */
+
+/* NetBSD: swap.c,v 1.4 1995/08/31 22:20:19 jtc Exp */
+
+/*-
+ * Copyright (c) 1980, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/swap.h>
@@ -27,141 +75,151 @@
#include <glibtop_suid.h>
+#include <sys/types.h>
#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#ifdef __FreeBSD__
#include <sys/rlist.h>
+#else
+#include <sys/map.h>
+#endif
#include <sys/vmmeter.h>
+/*--------------------- The remainder of this file is based/borrowed
+ * from /usr/src/bin/systat/swap.c in the NetBSD
+ * distribution. Modifications will be
+ * bracketed by comment markers like these. BCG
+ */
+
+/*
+ * swapinfo - based on a program of the same name by Kevin Lahey
+ */
+
+/*--------------------- Note: all of these includes were in the
+ * original source code. I am leaving them
+ * undisturbed, although it is likely that
+ * some may be removed, since lots of the swap
+ * code has been removed. BCG FIXME SOMEDAY
+ */
+
+#include <sys/param.h>
+/*--------------------- It appears buf.h is not needed, and
+ * causes breakage on FreeBSD. */
+/*#include <sys/buf.h>*/
+#include <kvm.h>
+#include <nlist.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/cdefs.h>
+#include <fcntl.h>
+
+/* extern char *getbsize __P((int *headerlenp, long *printoutblocksizep)); */
+
+static int nswap, nswdev, dmmax;
+static struct swdevt *sw;
+static long *perdev;
+#ifdef __FreeBSD__
+static struct rlisthdr swaplist;
+#else
+static int nswapmap;
+static struct map *swapmap, *kswapmap;
+static struct mapent *mp;
+#endif
+static int nfree;
+
static const unsigned long _glibtop_sysdeps_swap =
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
(1 << GLIBTOP_SWAP_PAGEOUT);
/* nlist structure for kernel access */
-static struct nlist nlst [] = {
-#define VM_SWAPLIST 0
- { "_swaplist" },/* list of free swap areas */
-#define VM_SWDEVT 1
+static struct nlist syms [] = {
+#define VM_SWDEVT 0
{ "_swdevt" }, /* list of swap devices and sizes */
-#define VM_NSWAP 2
+#define VM_NSWAP 1
{ "_nswap" }, /* size of largest swap device */
-#define VM_NSWDEV 3
+#define VM_NSWDEV 2
{ "_nswdev" }, /* number of swap devices */
-#define VM_DMMAX 4
+#define VM_DMMAX 3
{ "_dmmax" }, /* maximum size of a swap block */
+#ifdef __NetBSD__
+ { "_swapmap" }, /* list of free swap areas */
+#define VM_SWAPMAP 4
+ { "_nswapmap" },/* size of the swap map */
+#define VM_NSWAPMAP 5
+#else
+ { "_swaplist" },/* list of free swap areas */
+#define VM_SWAPLIST 4
+#endif /* !NetBSD */
{ 0 }
};
-/* Init function. */
+#define SVAR(var) __STRING(var) /* to force expansion */
+#define KGET(idx, var) \
+ KGET1(idx, &var, sizeof(var), SVAR(var))
+#define KGET1(idx, p, s, msg) \
+ KGET2(syms[idx].n_value, p, s, msg)
+#define KGET2(addr, p, s, msg) \
+ if (kvm_read(server->machine.kd, addr, p, s) != s) { \
+ glibtop_error_io_r(server, "cannot read %s: %s", msg, kvm_geterr(server->machine.kd)); \
+ return (0); \
+ }
-void
-glibtop_init_swap_p (glibtop *server)
+
+static int
+BSDInitSwapInfo(glibtop *server)
{
- server->sysdeps.swap = _glibtop_sysdeps_swap;
+ static int once = 0;
+ u_long ptr;
- if (kvm_nlist (server->machine.kd, nlst) != 0)
- glibtop_error_io_r (server, "kvm_nlist");
+ (void) ptr; /* Avoid gcc warnings. */
+ if (once)
+ return (1);
+ if (kvm_nlist(server->machine.kd, syms)) {
+ return (0);
+ }
+ KGET(VM_NSWAP, nswap);
+ KGET(VM_NSWDEV, nswdev);
+ KGET(VM_DMMAX, dmmax);
+#ifdef __FreeBSD__
+ sw = glibtop_malloc_r (server, nswdev * sizeof(*sw));
+ perdev = glibtop_malloc_r (server, nswdev * sizeof(*perdev));
+ KGET1(VM_SWDEVT, &ptr, sizeof ptr, "swdevt");
+ KGET2(ptr, sw, (signed) (nswdev * sizeof(*sw)), "*swdevt");
+#else /* __FreeBSD__ */
+ KGET(VM_NSWAPMAP, nswapmap);
+ KGET(VM_SWAPMAP, kswapmap); /* kernel `swapmap' is a pointer */
+ sw = glibtop_malloc_r (server, nswdev * sizeof(*sw));
+ perdev = glibtop_malloc_r (server, nswdev * sizeof(*perdev));
+ mp = glibtop_malloc_r(server, nswapmap * sizeof(*mp));
+ KGET1(VM_SWDEVT, sw, (signed) (nswdev * sizeof(*sw)), "swdevt");
+#endif /* __FreeBSD__ */
+ once = 1;
+ return (1);
}
-/* Provides information about swap usage. */
-
-/*
- * This function is based on a program called swapinfo written
- * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
- */
-
-void
-glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
+#ifdef __FreeBSD__
+/* Taken verbatim from /usr/src/usr.bin/systat/swap.c (pavel 24-Jan-1998) */
+int
+fetchswap(glibtop *server)
{
- char *header;
- int hlen, nswap, nswdev, dmmax;
- int i, div, avail, nfree, npfree, used;
- struct swdevt *sw;
- long blocksize, *perdev;
struct rlist head;
- struct rlisthdr swaplist;
struct rlist *swapptr;
- size_t sw_size;
- u_long ptr;
-
- /* To get `pagein' and `pageout'. */
- struct vmmeter vmm;
- static int swappgsin = -1;
- static int swappgsout = -1;
-
- glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SWAP), 0);
-
- memset (buf, 0, sizeof (glibtop_swap));
-
- /* This is used to get the `pagein' and `pageout' members. */
-
- if (kvm_read (server->machine.kd, nlst[0].n_value,
- &vmm, sizeof (vmm)) != sizeof (vmm))
- glibtop_error_io_r (server, "kvm_read (cnt)");
-
- if (swappgsin < 0) {
- buf->pagein = 0;
- buf->pageout = 0;
- } else {
- buf->pagein = vmm.v_swappgsin - swappgsin;
- buf->pageout = vmm.v_swappgsout - swappgsout;
- }
-
- swappgsin = vmm.v_swappgsin;
- swappgsout = vmm.v_swappgsout;
-
- /* Size of largest swap device. */
-
- if (kvm_read (server->machine.kd, nlst[VM_NSWAP].n_value,
- &nswap, sizeof (nswap)) != sizeof (nswap))
- glibtop_error_io_r (server, "kvm_read (nswap)");
-
- /* Number of swap devices. */
-
- if (kvm_read (server->machine.kd, nlst[VM_NSWDEV].n_value,
- &nswdev, sizeof (nswdev)) != sizeof (nswdev))
- glibtop_error_io_r (server, "kvm_read (nswdev)");
-
- /* Maximum size of a swap block. */
-
- if (kvm_read (server->machine.kd, nlst[VM_DMMAX].n_value,
- &dmmax, sizeof (dmmax)) != sizeof (dmmax))
- glibtop_error_io_r (server, "kvm_read (dmmax)");
-
- /* List of free swap areas. */
-
- if (kvm_read (server->machine.kd, nlst[VM_SWAPLIST].n_value,
- &swaplist, sizeof (swaplist)) != sizeof (swaplist))
- glibtop_error_io_r (server, "kvm_read (swaplist)");
-
- /* Kernel offset of list of swap devices and sizes. */
-
- if (kvm_read (server->machine.kd, nlst[VM_SWDEVT].n_value,
- &ptr, sizeof (ptr)) != sizeof (ptr))
- glibtop_error_io_r (server, "kvm_read (swaplist)");
-
- /* List of swap devices and sizes. */
-
- sw_size = nswdev * sizeof (*sw);
- sw = glibtop_malloc_r (server, sw_size);
-
- if (kvm_read (server->machine.kd, ptr, sw, sw_size) != sw_size)
- glibtop_error_io_r (server, "kvm_read (*swdevt)");
-
- perdev = glibtop_malloc (nswdev * sizeof (*perdev));
/* Count up swap space. */
-
nfree = 0;
- memset (perdev, 0, nswdev * sizeof(*perdev));
-
+ memset(perdev, 0, nswdev * sizeof(*perdev));
+ KGET1(VM_SWAPLIST, &swaplist, sizeof swaplist, "swaplist");
swapptr = swaplist.rlh_list;
-
while (swapptr) {
int top, bottom, next_block;
- if (kvm_read (server->machine.kd, (int) swapptr, &head,
- sizeof (struct rlist)) != sizeof (struct rlist))
- glibtop_error_io_r (server, "kvm_read (swapptr)");
+ KGET2((unsigned long)swapptr, &head,
+ sizeof(struct rlist), "swapptr");
top = head.rl_end;
bottom = head.rl_start;
@@ -191,43 +249,136 @@
swapptr = head.rl_next;
}
+ return 0;
- header = getbsize (&hlen, &blocksize);
+}
+#else /* __FreeBSD__ */
+void
+fetchswap(glibtop *server)
+{
+ int s, e, i;
+ int elast;
+ struct mapent* localmp;
+
+ localmp = mp;
+ s = nswapmap * sizeof(*localmp);
+ if (kvm_read(server->machine.kd, (long)kswapmap, localmp, s) != s)
+ glibtop_error_io_r(server, "cannot read swapmap: %s", kvm_geterr(server->machine.kd));
+
+ /* first entry in map is `struct map'; rest are mapent's */
+ swapmap = (struct map *)localmp;
+ if (!swapmap) {
+ glibtop_error_io_r(server, "Error: swapmap appears to be %p", swapmap);
+ }
+ if (nswapmap != swapmap->m_limit - (struct mapent *)kswapmap)
+ glibtop_error_io_r(server, "panic: swap: nswapmap goof");
- div = blocksize / 512;
- avail = npfree = 0;
- for (i = 0; i < nswdev; i++) {
- int xsize, xfree;
+ /*
+ * Count up swap space.
+ */
+ nfree = 0;
+ elast = 0;
+ bzero(perdev, nswdev * sizeof(*perdev));
+ for (localmp++; localmp->m_addr != 0; localmp++) {
+ s = localmp->m_addr; /* start of swap region */
+ e = localmp->m_addr + localmp->m_size; /* end of region */
+ elast = e;
+ nfree += localmp->m_size;
+
+ /*
+ * Swap space is split up among the configured disks.
+ * The first dmmax blocks of swap space some from the
+ * first disk, the next dmmax blocks from the next,
+ * and so on. The list of free space joins adjacent
+ * free blocks, ignoring device boundries. If we want
+ * to keep track of this information per device, we'll
+ * just have to extract it ourselves.
+ */
+
+ /* calculate first device on which this falls */
+ i = (s / dmmax) % nswdev;
+ while (s < e) { /* XXX this is inefficient */
+ int bound = roundup(s + 1, dmmax);
+
+ if (bound > e)
+ bound = e;
+ perdev[i] += bound - s;
+ if (++i >= nswdev)
+ i = 0;
+ s = bound;
+ }
+ }
+}
+#endif /* __FreeBSD__ */
- /*
- * Don't report statistics for partitions which have not
- * yet been activated via swapon(8).
- */
- if (!(sw[i].sw_flags & SW_FREED))
- continue;
+static void
+BSDGetSwapInfo(glibtop *server, glibtop_swap *buf)
+{
+ int i, avail, npfree, xsize, xfree;
- /* The first dmmax is never allocated to avoid trashing of
- * disklabels
- */
- xsize = sw[i].sw_nblks - dmmax;
+ fetchswap(server);
+ avail = npfree = buf->used = buf->pagein = buf->pageout = 0;
+ for (i = 0; i < nswdev; i++) {
+ /*
+ * Don't report statistics for partitions which have not
+ * yet been activated via swapon(8).
+ */
+ if (!sw[i].sw_freed) {
+ /* ----- Originally, this printed a
+ * warning. However, for xosview, we
+ * don't want the warning printed.
+ * bgrayson */
+ continue;
+ }
+#ifdef __FreeBSD__
+ /*
+ * The first dmmax is never allocated to avoid trashing of
+ * disklabels
+ */
+ /*xsize = sw[i].sw_nblks - dmmax;*/
+ /* Actually, count those dmmax blocks -- pstat,
+ * top, etc. do. It is swap space that is not
+ * free for use. bgrayson, on suggestion from
+ * Andrew Sharp. */
+ xsize = sw[i].sw_nblks;
+#else
+ xsize = sw[i].sw_nblks;
+#endif /* __FreeBSD__ */
xfree = perdev[i];
- used = xsize - xfree;
- npfree++;
- avail += xsize;
- }
+ buf->used = xsize - xfree;
+ npfree++;
+ avail += xsize;
+ }
+ /*
+ * If only one partition has been set up via swapon(8), we don't
+ * need to bother with totals.
+ */
+ if (npfree > 1) {
+ buf->used = avail - nfree;
+ }
+ /* Convert from 512-byte blocks to bytes. */
+ buf->total = 512*avail;
+ buf->free = 512*(avail-buf->used);
+}
- /*
- * If only one partition has been set up via swapon(8), we don't
- * need to bother with totals.
- */
- used = avail - nfree;
+/* Provides information about swap usage. */
- glibtop_free_r (server, sw);
- glibtop_free_r (server, perdev);
+/*
+ * This function is based on a program called swapinfo written
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
+ */
+void
+glibtop_init_swap_p(glibtop *server)
+{
+ server->sysdeps.swap = _glibtop_sysdeps_swap;
- buf->used = used;
- buf->free = avail;
+ if (kvm_nlist (server->machine.kd, syms) != 0)
+ glibtop_error_io_r (server, "kvm_nlist");
+ BSDInitSwapInfo(server);
+}
- buf->total = used + avail;
- buf->flags = _glibtop_sysdeps_swap;
+void
+glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
+{
+ BSDGetSwapInfo(server, buf);
}

View file

@ -1,17 +0,0 @@
$NetBSD: patch-af,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- sysdeps/bsd/shm_limits.c 1998/10/06 17:04:40 1.1
+++ sysdeps/bsd/shm_limits.c 1998/10/06 17:08:48
@@ -27,7 +27,12 @@
/* #define KERNEL to get declaration of `struct shminfo'. */
+/* Tut, tut, tut - what about those namespaces? */
+#ifdef __NetBSD__
+#define _KERNEL
+#else
#define KERNEL
+#endif
#include <sys/ipc.h>
#include <sys/shm.h>

View file

@ -1,17 +0,0 @@
$NetBSD: patch-ag,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- sysdeps/bsd/msg_limits.c 1998/10/06 17:10:11 1.1
+++ sysdeps/bsd/msg_limits.c 1998/10/06 17:10:53
@@ -27,7 +27,12 @@
/* #define KERNEL to get declaration of `struct msginfo'. */
+/* You gotta remember those namespaces. OTOH, maybe not ... */
+#ifdef __NetBSD__
+#define _KERNEL
+#else
#define KERNEL
+#endif
#include <sys/ipc.h>
#include <sys/msg.h>

View file

@ -1,17 +0,0 @@
$NetBSD: patch-ah,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- sysdeps/bsd/sem_limits.c 1998/10/06 17:11:38 1.1
+++ sysdeps/bsd/sem_limits.c 1998/10/06 17:12:15
@@ -27,7 +27,12 @@
/* #define KERNEL to get declaration of `struct seminfo'. */
+/* Why should this be any different? */
+#ifdef __NetBSD__
+#define _KERNEL
+#else
#define KERNEL
+#endif
#include <sys/ipc.h>
#include <sys/sem.h>

View file

@ -1,60 +0,0 @@
$NetBSD: patch-ai,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- sysdeps/bsd/procmem.c 1998/10/07 11:22:59 1.1
+++ sysdeps/bsd/procmem.c 1998/10/07 11:39:30
@@ -31,6 +31,9 @@
#include <sys/resource.h>
#include <vm/vm_object.h>
#include <vm/vm_map.h>
+#ifdef __NetBSD__
+#include <vm/vnode_pager.h>
+#endif
#include <sys/vnode.h>
#include <ufs/ufs/quota.h>
@@ -96,6 +99,9 @@
struct vnode vnode;
struct inode inode;
int count;
+#ifdef __NetBSD__
+ vn_pager_t vnpage;
+#endif
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MEM), 0);
@@ -150,8 +156,16 @@
&entry, sizeof (entry)) != sizeof (entry))
glibtop_error_io_r (server, "kvm_read (entry)");
+#ifdef __FreeBSD__
if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
continue;
+#elseif defined(UVM)
+ if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
+ continue;
+#else
+ if (entry.is_a_map || entry.is_sub_map)
+ continue;
+#endif
if (!entry.object.vm_object)
continue;
@@ -165,10 +179,17 @@
/* If the object is of type vnode, add its size */
+#ifdef __FreeBSD__
if (object.type != OBJT_VNODE)
continue;
-
buf->share += object.un_pager.vnp.vnp_size;
+#else
+ if (object.pager->pg_type != PG_VNODE)
+ continue;
+ vnpage = (vn_pager_t) object.pager->pg_handle;
+ buf->share += vnpage->vnp_size;
+#endif
+
}
glibtop_suid_leave (server);

View file

@ -1,25 +0,0 @@
$NetBSD: patch-aj,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- sysdeps/bsd/prockernel.c 1998/10/07 11:54:44 1.1
+++ sysdeps/bsd/prockernel.c 1998/10/07 12:01:57
@@ -31,7 +31,9 @@
#include <sys/proc.h>
#include <sys/user.h>
#include <machine/pcb.h>
+#ifdef __FreeBSD__
#include <machine/tss.h>
+#endif
#include <unistd.h>
#include <fcntl.h>
@@ -120,8 +122,10 @@
{
/* Same like with pstats above. */
+#ifdef __FreeBSD__
buf->kstk_esp = (u_int64_t) pcb.pcb_ksp;
buf->kstk_eip = (u_int64_t) pcb.pcb_pc;
+#endif
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
}

View file

@ -1,60 +0,0 @@
$NetBSD: patch-ak,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- sysdeps/bsd/procmap.c 1998/10/07 12:03:03 1.1
+++ sysdeps/bsd/procmap.c 1998/10/07 12:09:41
@@ -33,6 +33,9 @@
#include <vm/vm_object.h>
#include <vm/vm_prot.h>
#include <vm/vm_map.h>
+#ifdef __NetBSD__
+#include <vm/vnode_pager.h>
+#endif
#include <sys/vnode.h>
#include <sys/mount.h>
@@ -130,8 +133,16 @@
update = 1;
}
+#ifdef __FreeBSD__
if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
continue;
+#elseif defined(UVM)
+ if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
+ continue;
+#else
+ if (entry.is_a_map || entry.is_sub_map)
+ continue;
+#endif
maps [i].flags = _glibtop_sysdeps_map_entry;
@@ -162,16 +173,26 @@
/* If the object is of type vnode, add its size */
+#ifdef __FreeBSD__
if (object.type != OBJT_VNODE)
continue;
-
if (!object.handle)
continue;
-
if (kvm_read (server->machine.kd,
(unsigned long) object.handle,
&vnode, sizeof (vnode)) != sizeof (vnode))
glibtop_error_io_r (server, "kvm_read (vnode)");
+#else
+ if (object.pager->pg_type != PG_VNODE)
+ continue;
+ if (!object.pager->pg_handle)
+ continue;
+ if (kvm_read (server->machine.kd,
+ (unsigned long) object.pager->pg_handle,
+ &vnode, sizeof (vnode)) != sizeof (vnode))
+ glibtop_error_io_r (server, "kvm_read (vnode)");
+#endif
+
if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
!vnode.v_data) continue;

View file

@ -1,13 +0,0 @@
$NetBSD: patch-al,v 1.1.1.1 1998/10/07 13:11:35 agc Exp $
--- Makefile.in 1998/10/07 12:44:49 1.1
+++ Makefile.in 1998/10/07 12:45:27
@@ -48,7 +48,7 @@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_SCRIPT = ${BSD_INSTALL_SCRIPT}
transform = @program_transform_name@
NORMAL_INSTALL = :

View file

@ -1,46 +0,0 @@
$NetBSD: patch-am,v 1.2 1998/11/01 23:07:31 tron Exp $
--- sysdeps/bsd/procsignal.c.orig Wed Sep 9 01:54:54 1998
+++ sysdeps/bsd/procsignal.c Sun Nov 1 23:20:05 1998
@@ -63,22 +63,38 @@
/* signal: mask of pending signals.
* pinfo [0].kp_proc.p_siglist
*/
+#if defined(__NetBSD__) && (NSIG > 32)
+ buf->signal = pinfo [0].kp_proc.p_siglist.__bits[0];
+#else
buf->signal = pinfo [0].kp_proc.p_siglist;
+#endif
/* blocked: mask of blocked signals.
* pinfo [0].kp_proc.p_sigmask
*/
- buf->blocked = pinfo [0].kp_proc.p_sigmask;
+#if defined(__NetBSD__) && (NSIG > 32)
+ buf->signal = pinfo [0].kp_proc.p_sigmask.__bits[0];
+#else
+ buf->signal = pinfo [0].kp_proc.p_sigmask;
+#endif
/* sigignore: mask of ignored signals.
* pinfo [0].kp_proc.p_sigignore
*/
- buf->sigignore = pinfo [0].kp_proc.p_sigignore;
+#if defined(__NetBSD__) && (NSIG > 32)
+ buf->signal = pinfo [0].kp_proc.p_sigignore.__bits[0];
+#else
+ buf->signal = pinfo [0].kp_proc.p_sigignore;
+#endif
/* sigcatch: mask of caught signals.
* pinfo [0].kp_proc.p_sigcatch
*/
- buf->sigcatch = pinfo [0].kp_proc.p_sigcatch;
+#if defined(__NetBSD__) && (NSIG > 32)
+ buf->signal = pinfo [0].kp_proc.p_sigcatch.__bits[0];
+#else
+ buf->signal = pinfo [0].kp_proc.p_sigcatch;
+#endif
buf->flags = _glibtop_sysdeps_proc_signal;
}

View file

@ -1 +0,0 @@
library to retrieve system information, used in GNOME.

View file

@ -1,5 +0,0 @@
libgtop is a library that fetches system information about the running
system such as cpu and memory usage, active processes etc. It
provides a setgid server that fetches the information and a
client-side library that talks to this server.

View file

@ -1,73 +0,0 @@
@comment $NetBSD: PLIST,v 1.2 1998/10/18 22:31:00 tron Exp $
bin/libgtop_daemon
bin/libgtop_server
bin/libgtop-config
include/glibtop/close.h
include/glibtop/loadavg.h
include/glibtop/prockernel.h
include/glibtop/procstate.h
include/glibtop/sem_limits.h
include/glibtop/uptime.h
include/glibtop/command.h
include/glibtop/mem.h
include/glibtop/proclist.h
include/glibtop/proctime.h
include/glibtop/shm_limits.h
include/glibtop/version.h
include/glibtop/cpu.h
include/glibtop/msg_limits.h
include/glibtop/procmem.h
include/glibtop/procuid.h
include/glibtop/swap.h
include/glibtop/write.h
include/glibtop/error.h
include/glibtop/open.h
include/glibtop/procsegment.h
include/glibtop/read.h
include/glibtop/sysdeps.h
include/glibtop/xmalloc.h
include/glibtop/global.h
include/glibtop/procsignal.h
include/glibtop/read_data.h
include/glibtop/union.h
include/glibtop/types.h
include/glibtop/gnuserv.h
include/glibtop/parameter.h
include/glibtop/mountlist.h
include/glibtop/fsusage.h
include/glibtop/procmap.h
include/glibtop/signal.h
include/glibtop/inodedb.h
include/glibtop_server.h
include/glibtop_machine.h
include/glibtop_suid.h
include/glibtop.h
lib/locale/fr/LC_MESSAGES/libgtop.cat
lib/libgtop_sysdeps.so.0.0
lib/libgtop_sysdeps.a
lib/libgtop_sysdeps_suid.so.0.0
lib/libgtop_sysdeps_suid.a
lib/libgtop_common.so.0.0
lib/libgtop_common.a
lib/libgtop_suid_common.so.0.0
lib/libgtop_suid_common.a
lib/libgtop_names.so.0.0
lib/libgtop_names.a
lib/libgtop_guile_names.so.0.0
lib/libgtop_guile_names.a
lib/libgtop_guile.so.0.0
lib/libgtop_guile.a
lib/libgtop.so.0.0
lib/libgtop.a
lib/libgtopConf.sh
libexec/first
libexec/first_static
libexec/second
libexec/second_static
libexec/mountlist
libexec/mountlist_static
libexec/procmap
libexec/procmap_static
libexec/third
libexec/third_static
@dirrm include/glibtop