Finish move of libgtop from devel to sysutils, incomplete due to conflicts...

So I now see the package was previously here; the reason for the move is to
lighten a bit the devel category, which has lots of packages.
This commit is contained in:
jmmv 2004-04-02 12:13:57 +00:00
parent ecd4dcaec5
commit 3f222a4d4a
9 changed files with 402 additions and 0 deletions

55
sysutils/libgtop/Makefile Normal file
View file

@ -0,0 +1,55 @@
# $NetBSD: Makefile,v 1.5 2004/04/02 12:13:57 jmmv Exp $
DISTNAME= libgtop-1.0.13
PKGREVISION= 4
CATEGORIES= sysutils gnome
MASTER_SITES= ${MASTER_SITE_GNOME:=sources/libgtop/1.0/}
EXTRACT_SUFX= .tar.bz2
MAINTAINER= tron@NetBSD.org
HOMEPAGE= http://www.gnome.org/
COMMENT= Library to retrieve system information, used in GNOME
BUILD_USES_MSGFMT= yes
NOT_FOR_PLATFORM= SunOS-*-*
OSVERSION_SPECIFIC= yes
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == NetBSD
. if (${MACHINE_ARCH} != alpha) && (${MACHINE_ARCH} != x86_64) && \
(${MACHINE_ARCH} != arm) && (${MACHINE_ARCH} != arm32) && \
(${MACHINE_ARCH} != i386) && (${MACHINE_ARCH} != m68k) && \
(${MACHINE_ARCH} != mipsel) && (${MACHINE_ARCH} != powerpc) && \
(${MACHINE_ARCH} != sparc) && (${MACHINE_ARCH} != sparc64)
PKG_FAIL_REASON= "${PKGNAME} has not yet been ported to ${MACHINE_ARCH}."
PKG_FAIL_REASON+= "Please look at /usr/include/${MACHINE_ARCH}/pcb.h"
PKG_FAIL_REASON+= "and update patches/patch-al appropriately."
PKG_FAIL_REASON+= "(More information can be found in libgtop.info.)"
. endif
.endif
USE_PERL5= build
USE_BUILDLINK2= yes
USE_PKGLOCALEDIR= yes
USE_X11BASE= YES
USE_GNU_TOOLS+= make
USE_LIBTOOL= YES
USE_MAKEINFO= YES
INFO_FILES= libgtop.info
# The following flags are for debugging purposes. They don't need to
# be used unless you are actively developing/debugging libgtop.
#CPPFLAGS+= -DLIBGTOP_ENABLE_DEBUG -DLIBGTOP_FATAL_WARNINGS
#CFLAGS+= -g
#LDFLAGS+= -g
GNU_CONFIGURE= YES
CONFIGURE_ARGS+= --with-glib-prefix=${BUILDLINK_PREFIX.glib} \
--with-catgets --with-libgtop-guile=no
CONFIGURE_ENV+= AWK="${AWK}" LN_S="${LN} -s" PERL="${PERL5}"
.include "../../devel/gettext-lib/buildlink2.mk"
.include "../../x11/gnome-libs/buildlink2.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -0,0 +1,19 @@
$NetBSD: patch-aa,v 1.3 2004/04/02 12:13:57 jmmv Exp $
--- sysdeps/freebsd/glibtop_machine.h.orig Mon Nov 26 23:37:59 2001
+++ sysdeps/freebsd/glibtop_machine.h Sun Jan 19 23:18:04 2003
@@ -39,6 +39,14 @@
#include <osreldate.h>
#endif
+#ifdef __NetBSD__
+#include <sys/proc.h>
+
+#ifndef SRUN
+#define SRUN SACTIVE
+#endif
+#endif
+
BEGIN_LIBGTOP_DECLS
typedef struct _glibtop_machine glibtop_machine;

View file

@ -0,0 +1,48 @@
$NetBSD: patch-ab,v 1.4 2004/04/02 12:13:57 jmmv Exp $
--- sysdeps/freebsd/procsignal.c.orig Sun Feb 13 22:31:39 2000
+++ sysdeps/freebsd/procsignal.c Wed Jan 3 00:42:45 2001
@@ -70,7 +70,9 @@
/* signal: mask of pending signals.
* pinfo [0].kp_proc.p_siglist
*/
-#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
+#if defined(__NetBSD__) && (__NetBSD_Version__ > 105150000)
+ buf->signal [0] = pinfo [0].kp_proc.p_sigctx.ps_siglist.__bits[0];
+#elif (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
buf->signal [0] = pinfo [0].kp_proc.p_siglist.__bits[0];
#else
buf->signal [0] = pinfo [0].kp_proc.p_siglist;
@@ -79,7 +81,9 @@
/* blocked: mask of blocked signals.
* pinfo [0].kp_proc.p_sigmask
*/
-#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
+#if defined(__NetBSD__) && (__NetBSD_Version__ > 105150000)
+ buf->blocked [0] = pinfo [0].kp_proc.p_sigctx.ps_sigmask.__bits[0];
+#elif (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
buf->blocked [0] = pinfo [0].kp_proc.p_sigmask.__bits[0];
#else
buf->blocked [0] = pinfo [0].kp_proc.p_sigmask;
@@ -88,7 +92,9 @@
/* sigignore: mask of ignored signals.
* pinfo [0].kp_proc.p_sigignore
*/
-#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
+#if defined(__NetBSD__) && (__NetBSD_Version__ > 105150000)
+ buf->sigignore [0] = pinfo [0].kp_proc.p_sigctx.ps_sigignore.__bits[0];
+#elif (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore.__bits[0];
#else
buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore;
@@ -97,7 +103,9 @@
/* sigcatch: mask of caught signals.
* pinfo [0].kp_proc.p_sigcatch
*/
-#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
+#if defined(__NetBSD__) && (__NetBSD_Version__ > 105150000)
+ buf->sigcatch [0] = pinfo [0].kp_proc.p_sigctx.ps_sigcatch.__bits[0];
+#elif (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch.__bits[0];
#else
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch;

View file

@ -0,0 +1,18 @@
$NetBSD: patch-ac,v 1.3 2004/04/02 12:13:57 jmmv Exp $
--- include/glibtop/procstate.h.orig Tue Feb 23 06:43:11 1999
+++ include/glibtop/procstate.h Sun Aug 29 19:50:34 1999
@@ -36,6 +36,13 @@
#define GLIBTOP_MAX_PROC_STATE 4
+#define GLIBTOP_PROCESS_RUNNING 1
+#define GLIBTOP_PROCESS_INTERRUPTIBLE 2
+#define GLIBTOP_PROCESS_UNINTERRUPTIBLE 4
+#define GLIBTOP_PROCESS_ZOMBIE 8
+#define GLIBTOP_PROCESS_STOPPED 16
+#define GLIBTOP_PROCESS_SWAPPING 32
+
typedef struct _glibtop_proc_state glibtop_proc_state;
/* Name and status */

View file

@ -0,0 +1,17 @@
$NetBSD: patch-ad,v 1.3 2004/04/02 12:13:57 jmmv Exp $
--- sysdeps/freebsd/procargs.c.orig Thu May 27 16:04:01 1999
+++ sysdeps/freebsd/procargs.c Sat Jun 3 23:18:52 2000
@@ -83,9 +83,9 @@
args = kvm_getargv (server->machine.kd, pinfo, max_len);
if (args == NULL) {
- glibtop_suid_leave (server);
- glibtop_warn_io_r (server, "kvm_getargv (%d)", pid);
- return NULL;
+ static char *dummy = NULL;
+
+ args = &dummy;
}
glibtop_suid_leave (server);

View file

@ -0,0 +1,81 @@
$NetBSD: patch-ae,v 1.3 2004/04/02 12:13:57 jmmv Exp $
--- sysdeps/freebsd/cpu.c.orig Sun Feb 13 16:47:58 2000
+++ sysdeps/freebsd/cpu.c
@@ -27,11 +27,16 @@
#include <glibtop_suid.h>
+#ifdef __NetBSD__
+#include <sys/sched.h>
+#endif
+
static const unsigned long _glibtop_sysdeps_cpu =
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY);
+#ifndef KERN_CP_TIME
/* nlist structure for kernel access */
static struct nlist nlst [] = {
#ifdef __bsdi__
@@ -41,21 +46,27 @@
#endif
{ 0 }
};
+#endif
/* MIB array for sysctl */
static int mib_length=2;
static int mib [] = { CTL_KERN, KERN_CLOCKRATE };
+#ifdef KERN_CP_TIME
+static int mib2 [] = { CTL_KERN, KERN_CP_TIME };
+#endif
/* Init function. */
void
glibtop_init_cpu_p (glibtop *server)
{
+#ifndef KERN_CP_TIME
if (kvm_nlist (server->machine.kd, nlst) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (cpu)");
return;
}
+#endif
/* Set this only if kvm_nlist () succeeded. */
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
}
@@ -65,7 +76,11 @@
void
glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
{
+#ifdef KERN_CP_TIME
+ u_int64_t cpts [CPUSTATES];
+#else
long cpts [CPUSTATES];
+#endif
/* sysctl vars*/
struct clockinfo ci;
size_t length;
@@ -78,11 +93,19 @@
if (server->sysdeps.cpu == 0)
return;
+#ifdef KERN_CP_TIME
+ length = sizeof (cpts);
+ if (sysctl (mib2, mib_length, cpts, &length, NULL, 0)) {
+ glibtop_warn_io_r (server, "sysctl");
+ return;
+ }
+#else
if (kvm_read (server->machine.kd, nlst [0].n_value,
&cpts, sizeof (cpts)) != sizeof (cpts)) {
glibtop_warn_io_r (server, "kvm_read (cp_time)");
return;
}
+#endif
/* Get the clockrate data */
length = sizeof (struct clockinfo);

View file

@ -0,0 +1,28 @@
$NetBSD: patch-af,v 1.3 2004/04/02 12:13:57 jmmv Exp $
--- sysdeps/freebsd/procstate.c.orig Mon Nov 26 23:37:59 2001
+++ sysdeps/freebsd/procstate.c Sun Jan 19 23:21:15 2003
@@ -99,9 +99,11 @@
case SRUN:
buf->state = GLIBTOP_PROCESS_RUNNING;
break;
+#ifdef SSLEEP
case SSLEEP:
buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
break;
+#endif
case SSTOP:
buf->state = GLIBTOP_PROCESS_STOPPED;
break;
@@ -119,9 +121,11 @@
case SRUN:
buf->state = 'R';
break;
+#ifdef SSLEEP
case SSLEEP:
buf->state = 'S';
break;
+#endif
case SSTOP:
buf->state = 'T';
break;

View file

@ -0,0 +1,16 @@
$NetBSD: patch-ag,v 1.3 2004/04/02 12:13:57 jmmv Exp $
--- sysdeps/freebsd/procuid.c.orig Mon Nov 26 23:37:59 2001
+++ sysdeps/freebsd/procuid.c Sun Jan 19 23:26:08 2003
@@ -94,7 +94,11 @@
buf->tpgid = pinfo [0].kp_eproc.e_tpgid;
buf->nice = pinfo [0].kp_proc.p_nice;
+#if defined(__NetBSD__) && defined(SACTIVE)
+ buf->priority = 0;
+#else
buf->priority = pinfo [0].kp_proc.p_priority;
+#endif
/* Set the flags for the data we're about to return*/
buf->flags = _glibtop_sysdeps_proc_uid;

View file

@ -0,0 +1,120 @@
$NetBSD: patch-al,v 1.3 2004/04/02 12:13:57 jmmv Exp $
--- sysdeps/freebsd/prockernel.c.orig 2001-11-26 23:37:59.000000000 +0100
+++ sysdeps/freebsd/prockernel.c 2004-03-01 03:44:24.000000000 +0100
@@ -34,7 +34,7 @@
#if (!defined __OpenBSD__) && (!defined __bsdi__)
#include <sys/user.h>
#endif
-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__))
+#if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__)) && !defined(__NetBSD__)
#include <machine/pcb.h>
#endif
#if defined(__FreeBSD__) && !defined(__alpha__)
@@ -48,6 +48,14 @@
#include <osreldate.h>
#endif
+#ifdef __NetBSD__
+#include <machine/vmparam.h>
+#include <machine/pmap.h>
+#ifdef __arm32__
+#define KERNBASE KERNEL_BASE
+#endif
+#endif
+
static const unsigned long _glibtop_sysdeps_proc_kernel_pstats =
(1L << GLIBTOP_PROC_KERNEL_MIN_FLT) +
(1L << GLIBTOP_PROC_KERNEL_MAJ_FLT) +
@@ -101,6 +109,7 @@
if ((pinfo == NULL) || (count != 1))
glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
+#if !defined(__NetBSD__) || !defined(SACTIVE)
buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
buf->flags |= (1L << GLIBTOP_PROC_KERNEL_NWCHAN);
@@ -112,6 +121,7 @@
} else {
buf->wchan [0] = 0;
}
+#endif
/* Taken from `saveuser ()' in `/usr/src/bin/ps/ps.c'. */
@@ -129,8 +139,16 @@
glibtop_suid_enter (server);
+#if !defined(__NetBSD__) || !defined(SACTIVE)
+#ifdef __NetBSD__
+ /* On NetBSD, there is no kvm_uread(), and kvm_read() always reads
+ * from kernel memory. */
+
+ if (kvm_read (server->machine.kd,
+#else
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc,
+#endif
(unsigned long) &u_addr->u_stats,
(char *) &pstats, sizeof (pstats)) == sizeof (pstats))
{
@@ -148,9 +166,14 @@
buf->flags |= _glibtop_sysdeps_proc_kernel_pstats;
}
+#endif
+#ifdef __NetBSD__
+ if (kvm_read (server->machine.kd,
+#else
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc,
+#endif
(unsigned long) &u_addr->u_pcb,
(char *) &pcb, sizeof (pcb)) == sizeof (pcb))
{
@@ -167,15 +190,43 @@
/*xxx FreeBSD/Alpha? */
#endif
#else
+#ifdef __i386__
buf->kstk_esp = (u_int64_t) pcb.pcb_tss.tss_esp0;
#ifdef __bsdi__
buf->kstk_eip = (u_int64_t) pcb.pcb_tss.tss_eip;
#else
buf->kstk_eip = (u_int64_t) pcb.pcb_tss.__tss_eip;
#endif
+#else
+#if defined(__NetBSD__)
+#if defined(__m68k__)
+ buf->kstk_esp = (u_int64_t) pcb.pcb_usp;
+ buf->kstk_eip = (u_int64_t) 0;
+#elif defined(__x86_64__)
+ buf->kstk_esp = (u_int64_t) pcb.pcb_usersp;
+ buf->kstk_eip = (u_int64_t) 0;
+#elif (defined(__arm32__) || defined(__powerpc__))
+ buf->kstk_esp = (u_int64_t) pcb.pcb_sp;
+ buf->kstk_eip = (u_int64_t) 0;
+#elif defined(__mipsel__)
+ buf->kstk_esp = (u_int64_t) pcb.pcb_context[8];
+ buf->kstk_eip = (u_int64_t) 0;
+#elif defined(__sparc__)
+ buf->kstk_esp = (u_int64_t) pcb.pcb_sp;
+ buf->kstk_eip = (u_int64_t) pcb.pcb_pc;
+#elif defined(__alpha__)
+ buf->kstk_esp = (u_int64_t) pcb.pcb_context[9];
+ buf->kstk_eip = (u_int64_t) pcb.pcb_context[8];
+#else
+ /* provide some defaults for other platforms */
+ buf->kstk_esp = (u_int64_t) 0;
+ buf->kstk_eip = (u_int64_t) 0;
+#endif /* ${MACHINE_ARCH} */
+#endif /* __NetBSD__ */
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
#endif
+#endif
}
/* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */