Re-add libgtop. It should not have been deleted in this phase of the GNOME 1.4

removal.
This commit is contained in:
Joe Marcus Clarke 2003-07-15 21:40:22 +00:00
parent 521ec4981c
commit 60d7a78b60
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=84940
15 changed files with 829 additions and 0 deletions

34
devel/libgtop/Makefile Normal file
View file

@ -0,0 +1,34 @@
# New ports collection makefile for: libgtop
# Date Created: 26 Sep 1998
# Whom: Vanilla I. Shu <vanilla@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= libgtop
PORTVERSION= 1.0.13
PORTREVISION= 5
CATEGORIES= devel gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/${PORTNAME}/1.0
MAINTAINER= gnome@FreeBSD.org
COMMENT= GNOME top library
LIB_DEPENDS= guile.15:${PORTSDIR}/lang/guile
USE_PERL5= yes
USE_GMAKE= yes
USE_REINPLACE= yes
USE_GNOME= gnomelibs gnomehack
INSTALLS_SHLIB= yes
USE_LIBTOOL= yes
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LIBS="-L${LOCALBASE}/lib"
post-install:
install-info --section="Programming \& development tools" \
--entry="* libgtop: (libgtop). libgtop programming manual" \
${PREFIX}/info/libgtop.info ${PREFIX}/info/dir
.include <bsd.port.mk>

1
devel/libgtop/distinfo Normal file
View file

@ -0,0 +1 @@
MD5 (libgtop-1.0.13.tar.gz) = 305abba436c212f50d4be28464a14452

View file

@ -0,0 +1,32 @@
$FreeBSD$
--- Makefile.in.orig Mon Jan 28 16:22:04 2002
+++ Makefile.in Mon Jan 28 16:23:07 2002
@@ -193,7 +193,7 @@
EXTRA_DIST = autogen.sh libgtop.spec.in copyright.txt libgtopConf.sh.in LIBGTOP-VERSION features.def libgtop-config.in RELNOTES-0.25 RELNOTES-1.0 RELNOTES-1.0.x libgtop-sysdeps.m4 README libgtop-mirror.sh
-confexecdir = $(libdir)
+confexecdir = $(sysconfdir)
confexec_DATA = $(top_builddir)/libgtopConf.sh $(top_builddir)/libgtop-features.def
@@ -565,7 +565,7 @@
$(top_srcdir)/aclocal.m4: libgtop-sysdeps.m4 LIBGTOP-VERSION
libgtopConf.sh: libgtopConf.sh.in Makefile
- sed -e 's#\@LIBGTOP_LIBDIR\@#$(libdir)#g' \
+ sed -e 's#\@LIBGTOP_LIBDIR\@#$(confexecdir)#g' \
-e 's#\@LIBGTOP_INCLUDEDIR\@#$(includedir)/libgtop-1.0#g' \
-e 's#\@LIBGTOP_DATADIR\@#$(datadir)#g' \
-e 's#\@LIBGTOP_EXTRA_LIBS\@#$(LIBGTOP_EXTRA_LIBS)#g' \
@@ -594,7 +594,7 @@
&& mv libgtopConf.tmp libgtopConf.sh
libgtop-config: libgtop-config.in Makefile
- sed -e 's#\@LIBGTOP_LIBDIR\@#$(libdir)#g' \
+ sed -e 's#\@LIBGTOP_LIBDIR\@#$(confexecdir)#g' \
< $(srcdir)/libgtop-config.in > libgtop-config.tmp \
&& mv libgtop-config.tmp libgtop-config && \
chmod 755 libgtop-config

View file

@ -0,0 +1,41 @@
$FreeBSD$
--- configure.orig Tue Nov 27 00:50:58 2001
+++ configure Fri Jul 12 15:38:19 2002
@@ -1260,10 +1260,10 @@
# The aliases save the names the user supplied, while $host etc.
# will get canonicalized.
-test -n "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
+#test -n "$target_alias" &&
+# test "$program_prefix$program_suffix$program_transform_name" = \
+# NONENONEs,x,x, &&
+# program_prefix=${target_alias}-
# Extract the first word of "dc", so it can be a program name with args.
set dummy dc; ac_word=$2
@@ -1580,9 +1580,9 @@
# libtool versioning
LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION
-LT_CURRENT=`expr $LIBGTOP_MICRO_VERSION - $LIBGTOP_INTERFACE_AGE`
-LT_REVISION=$LIBGTOP_INTERFACE_AGE
-LT_AGE=`expr $LIBGTOP_BINARY_AGE - $LIBGTOP_INTERFACE_AGE`
+LT_CURRENT=1
+LT_REVISION=0
+LT_AGE=0
LT_VERSION_INFO='-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}'
if test x = y; then
@@ -7555,6 +7555,7 @@
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+$ac_aux_dir/ltconfig $LIBTOOL_DEPS
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'

View file

@ -0,0 +1,68 @@
--- sysdeps/freebsd/procmap.c.orig Mon Nov 26 17:37:59 2001
+++ sysdeps/freebsd/procmap.c Thu Nov 7 18:33:32 2002
@@ -33,7 +33,11 @@
#include <sys/proc.h>
#include <sys/resource.h>
#include <vm/vm_object.h>
+#if (__FreeBSD_version >= 400011)
+#include <vm/vm.h>
+#else
#include <vm/vm_prot.h>
+#endif
#include <vm/vm_map.h>
#include <sys/vnode.h>
@@ -91,8 +95,9 @@
glibtop_map_entry *maps;
#if defined __FreeBSD__
struct vnode vnode;
+#if __FreeBSD_version < 500039
struct inode inode;
- struct mount mount;
+#endif
#endif
int count, i = 0;
int update = 0;
@@ -114,7 +119,11 @@
/* Now we get the memory maps. */
if (kvm_read (server->machine.kd,
+#if (__FreeBSD_version >= 500013)
+ (unsigned long) pinfo [0].ki_vmspace,
+#else
(unsigned long) pinfo [0].kp_proc.p_vmspace,
+#endif
(char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace))
glibtop_error_io_r (server, "kvm_read (vmspace)");
@@ -244,6 +253,15 @@
&vnode, sizeof (vnode)) != sizeof (vnode))
glibtop_error_io_r (server, "kvm_read (vnode)");
+#if __FreeBSD_version >= 500039
+ switch (vnode.v_type) {
+ case VREG:
+ maps [i-1].inode = vnode.v_cachedid;
+ maps [i-1].device = vnode.v_cachedfs;
+ default:
+ continue;
+ }
+#else
if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
!vnode.v_data) continue;
@@ -252,13 +270,9 @@
&inode, sizeof (inode)) != sizeof (inode))
glibtop_error_io_r (server, "kvm_read (inode)");
- if (kvm_read (server->machine.kd,
- (unsigned long) vnode.v_mount,
- &mount, sizeof (mount)) != sizeof (mount))
- glibtop_error_io_r (server, "kvm_read (mount)");
-
maps [i-1].inode = inode.i_number;
maps [i-1].device = inode.i_dev;
+#endif
#endif
} while (entry.next != first);

View file

@ -0,0 +1,323 @@
--- sysdeps/freebsd/proclist.c.orig Thu May 27 09:04:05 1999
+++ sysdeps/freebsd/proclist.c Fri Dec 22 18:02:59 2000
@@ -88,9 +88,20 @@
for (i=j=0; i < count; i++) {
+#if __FreeBSD_version >= 500013
+#define XXX_P_STAT ki_stat
+#define XXX_P_RUID ki_ruid
+#define XXX_P_PID ki_pid
+
+#else
+#define XXX_P_STAT kp_proc.p_stat
+#define XXX_P_RUID kp_eproc.e_pcred.p_ruid
+#define XXX_P_PID kp_proc.p_pid
+
+#endif
if ((real_which & GLIBTOP_EXCLUDE_IDLE) &&
- (pinfo[i].kp_proc.p_stat != SRUN))
+ (pinfo[i].XXX_P_STAT != SRUN))
continue;
else if ((real_which & GLIBTOP_EXCLUDE_SYSTEM) &&
- (pinfo[i].kp_eproc.e_pcred.p_ruid == 0))
+ (pinfo[i].XXX_P_RUID == 0))
continue;
- pids [j++] = (unsigned) pinfo[i].kp_proc.p_pid;
+ pids [j++] = (unsigned) pinfo[i].XXX_P_PID;
} /* end for */
--- sysdeps/freebsd/procstate.c.orig Sat Oct 16 13:01:39 1999
+++ sysdeps/freebsd/procstate.c Fri Dec 22 18:00:55 2000
@@ -78,11 +78,29 @@
- strncpy (buf->cmd, pinfo [0].kp_proc.p_comm, sizeof (buf->cmd)-1);
+#if __FreeBSD_version >= 500013
+#define XXX_P_COMM ki_comm
+#define XXX_P_SVUID ki_svuid
+#define XXX_P_SVGID ki_svgid
+#define XXX_P_RUID ki_ruid
+#define XXX_P_RGID ki_rgid
+#define XXX_P_STAT ki_stat
+
+#else
+#define XXX_P_COMM kp_proc.p_comm
+#define XXX_P_SVUID kp_eproc.e_pcred.p_svuid
+#define XXX_P_SVGID kp_eproc.e_pcred.p_svgid
+#define XXX_P_RUID kp_eproc.e_pcred.p_ruid
+#define XXX_P_RGID kp_eproc.e_pcred.p_rgid
+#define XXX_P_STAT kp_proc.p_stat
+
+#endif
+
+ strncpy (buf->cmd, pinfo [0].XXX_P_COMM, sizeof (buf->cmd)-1);
buf->cmd [sizeof (buf->cmd)-1] = 0;
- buf->uid = pinfo [0].kp_eproc.e_pcred.p_svuid;
- buf->gid = pinfo [0].kp_eproc.e_pcred.p_svgid;
+ buf->uid = pinfo [0].XXX_P_SVUID;
+ buf->gid = pinfo [0].XXX_P_SVGID;
#if LIBGTOP_VERSION_CODE >= 1001000
- buf->ruid = pinfo [0].kp_eproc.e_pcred.p_ruid;
- buf->rgid = pinfo [0].kp_eproc.e_pcred.p_rgid;
+ buf->ruid = pinfo [0].XXX_P_RUID;
+ buf->rgid = pinfo [0].XXX_P_RGID;
#endif
@@ -94,3 +112,3 @@
#if LIBGTOP_VERSION_CODE >= 1001000
- switch (pinfo [0].kp_proc.p_stat) {
+ switch (pinfo [0].XXX_P_STAT) {
case SIDL:
@@ -114,3 +132,3 @@
#else
- switch (pinfo [0].kp_proc.p_stat) {
+ switch (pinfo [0].XXX_P_STAT) {
case SIDL:
--- sysdeps/freebsd/procuid.c.orig Fri Sep 17 06:08:07 1999
+++ sysdeps/freebsd/procuid.c Thu Feb 15 01:16:50 2001
@@ -86,13 +86,42 @@
- buf->uid = pinfo [0].kp_eproc.e_pcred.p_ruid;
- buf->euid = pinfo [0].kp_eproc.e_pcred.p_svuid;
- buf->gid = pinfo [0].kp_eproc.e_pcred.p_rgid;
- buf->egid = pinfo [0].kp_eproc.e_pcred.p_svgid;
-
- buf->ppid = pinfo [0].kp_eproc.e_ppid;
- buf->pgrp = pinfo [0].kp_eproc.e_pgid;
- buf->tpgid = pinfo [0].kp_eproc.e_tpgid;
+#if __FreeBSD_version >= 500013
- buf->nice = pinfo [0].kp_proc.p_nice;
- buf->priority = pinfo [0].kp_proc.p_priority;
+#define XXX_P_RUID ki_ruid
+#define XXX_P_SVUID ki_svuid
+#define XXX_P_RGID ki_rgid
+#define XXX_P_SVGID ki_svgid
+#define XXX_E_PPID ki_ppid
+#define XXX_E_PGID ki_pgid
+#define XXX_E_TPGID ki_tpgid
+#define XXX_P_NICE ki_nice
+#if __FreeBSD_version >= 500013
+#define XXX_P_PRIORITY ki_pri.pri_user
+#else
+#define XXX_P_PRIORITY ki_priority
+#endif
+#else
+
+#define XXX_P_RUID kp_eproc.e_pcred.p_ruid
+#define XXX_P_SVUID kp_eproc.e_pcred.p_svuid
+#define XXX_P_RGID kp_eproc.e_pcred.p_rgid
+#define XXX_P_SVGID kp_eproc.e_pcred.p_svgid
+#define XXX_E_PPID kp_eproc.e_ppid
+#define XXX_E_PGID kp_eproc.e_pgid
+#define XXX_E_TPGID kp_eproc.e_tpgid
+#define XXX_P_NICE kp_proc.p_nice
+#define XXX_P_PRIORITY kp_proc.p_priority
+
+#endif
+
+ buf->uid = pinfo [0].XXX_P_RUID;
+ buf->euid = pinfo [0].XXX_P_SVUID;
+ buf->gid = pinfo [0].XXX_P_RGID;
+ buf->egid = pinfo [0].XXX_P_SVGID;
+
+ buf->ppid = pinfo [0].XXX_E_PPID;
+ buf->pgrp = pinfo [0].XXX_E_PGID;
+ buf->tpgid = pinfo [0].XXX_E_TPGID;
+
+ buf->nice = pinfo [0].XXX_P_NICE;
+ buf->priority = pinfo [0].XXX_P_PRIORITY;
--- sysdeps/freebsd/procmem.c.orig Thu May 27 13:56:49 1999
+++ sysdeps/freebsd/procmem.c Wed Dec 27 10:16:26 2000
@@ -139,2 +139,18 @@
+#if __FreeBSD_version >= 500013
+
+#define XXX_P_VMSPACE ki_vmspace
+
+ buf->rss_rlim = pinfo [0].ki_rssize;
+
+ buf->vsize = buf->size = (u_int64_t) pagetok
+ (pinfo [0].ki_tsize + pinfo [0].ki_dsize + pinfo[0].ki_ssize)
+ << LOG1024;
+ buf->resident = buf->rss = (u_int64_t) pagetok
+ (pinfo [0].ki_rssize) << LOG1024;
+
+#else
+
+#define XXX_P_VMSPACE kp_proc.p_vmspace
+
if (kvm_read (server->machine.kd,
@@ -156,2 +172,3 @@
(vms->vm_rssize) << LOG1024;
+#endif
@@ -160,3 +177,3 @@
if (kvm_read (server->machine.kd,
- (unsigned long) pinfo [0].kp_proc.p_vmspace,
+ (unsigned long) pinfo [0].XXX_P_VMSPACE,
(char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) {
--- sysdeps/freebsd/procsignal.c.orig Sun Feb 13 15:31:39 2000
+++ sysdeps/freebsd/procsignal.c Wed Dec 27 10:22:28 2000
@@ -69,2 +69,18 @@
+#if __FreeBSD_version >= 500013
+
+#define XXX_P_SIGLIST ki_siglist
+#define XXX_P_SIGMASK ki_sigmask
+#define XXX_P_SIGIGNORE ki_sigignore
+#define XXX_P_SIGCATCH ki_sigcatch
+
+#else
+
+#define XXX_P_SIGLIST kp_proc.p_siglist
+#define XXX_P_SIGMASK kp_proc.p_sigmask
+#define XXX_P_SIGIGNORE kp_proc.p_sigignore
+#define XXX_P_SIGCATCH kp_proc.p_sigcatch
+
+#endif
+
/* signal: mask of pending signals.
@@ -73,3 +89,3 @@
#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
- buf->signal [0] = pinfo [0].kp_proc.p_siglist.__bits[0];
+ buf->signal [0] = pinfo [0].XXX_P_SIGLIST.__bits[0];
#else
@@ -82,3 +98,3 @@
#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
- buf->blocked [0] = pinfo [0].kp_proc.p_sigmask.__bits[0];
+ buf->blocked [0] = pinfo [0].XXX_P_SIGMASK.__bits[0];
#else
@@ -91,3 +107,3 @@
#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
- buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore.__bits[0];
+ buf->sigignore [0] = pinfo [0].XXX_P_SIGIGNORE.__bits[0];
#else
@@ -100,3 +116,3 @@
#if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011)
- buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch.__bits[0];
+ buf->sigcatch [0] = pinfo [0].XXX_P_SIGCATCH.__bits[0];
#else
--- sysdeps/freebsd/prockernel.c.orig Sat Oct 16 13:31:43 1999
+++ sysdeps/freebsd/prockernel.c Wed Dec 27 10:50:19 2000
@@ -36,8 +36,2 @@
#endif
-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__))
-#include <machine/pcb.h>
-#endif
-#if defined(__FreeBSD__) && !defined(__alpha__)
-#include <machine/tss.h>
-#endif
@@ -80,10 +74,4 @@
struct kinfo_proc *pinfo;
- struct user *u_addr = (struct user *)USRSTACK;
- struct pstats pstats;
- struct pcb pcb;
int count;
- char filename [BUFSIZ];
- struct stat statb;
-
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
@@ -103,7 +91,21 @@
- buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
+#if __FreeBSD_version >= 500013
+
+#define XXX_P_WCHAN ki_wchan
+#define XXX_P_WMESG ki_wmesg
+#define XXX_E_WMESG ki_wmesg
+
+#else
+
+#define XXX_P_WCHAN kp_proc.p_wchan
+#define XXX_P_WMESG kp_proc.p_wmesg
+#define XXX_E_WMESG kp_eproc.e_wmesg
+
+#endif
+
+ buf->nwchan = (unsigned long) pinfo [0].XXX_P_WCHAN &~ KERNBASE;
buf->flags |= (1L << GLIBTOP_PROC_KERNEL_NWCHAN);
- if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) {
- strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg,
+ if (pinfo [0].XXX_P_WCHAN && pinfo [0].XXX_P_WMESG) {
+ strncpy (buf->wchan, pinfo [0].XXX_E_WMESG,
sizeof (buf->wchan) - 1);
@@ -115,70 +117,8 @@
- /* Taken from `saveuser ()' in `/usr/src/bin/ps/ps.c'. */
-
- /* [FIXME]: /usr/include/sys/user.h tells me that the user area
- * may or may not be at the same kernel address in all
- * processes, but I don't see any way to get that address.
- * Since `ps' simply uses its own address, I think it's
- * safe to do this here, too. */
-
- /* NOTE: You need to mount the /proc filesystem to make
- * `kvm_uread' work. */
-
- sprintf (filename, "/proc/%d/mem", (int) pid);
- if (stat (filename, &statb)) return;
-
- glibtop_suid_enter (server);
-
- if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
- kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc,
- (unsigned long) &u_addr->u_stats,
- (char *) &pstats, sizeof (pstats)) == sizeof (pstats))
- {
- /*
- * The u-area might be swapped out, and we can't get
- * at it because we have a crashdump and no swap.
- * If it's here fill in these fields, otherwise, just
- * leave them 0.
- */
-
- buf->min_flt = (u_int64_t) pstats.p_ru.ru_minflt;
- buf->maj_flt = (u_int64_t) pstats.p_ru.ru_majflt;
- buf->cmin_flt = (u_int64_t) pstats.p_cru.ru_minflt;
- buf->cmaj_flt = (u_int64_t) pstats.p_cru.ru_majflt;
-
- buf->flags |= _glibtop_sysdeps_proc_kernel_pstats;
- }
-
- if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
- kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc,
- (unsigned long) &u_addr->u_pcb,
- (char *) &pcb, sizeof (pcb)) == sizeof (pcb))
- {
-#ifdef __FreeBSD__
-#ifndef __alpha__
-#if (__FreeBSD_version >= 300003)
- buf->kstk_esp = (u_int64_t) pcb.pcb_esp;
- buf->kstk_eip = (u_int64_t) pcb.pcb_eip;
-#else
- buf->kstk_esp = (u_int64_t) pcb.pcb_ksp;
- buf->kstk_eip = (u_int64_t) pcb.pcb_pc;
-#endif
-#else
- /*xxx FreeBSD/Alpha? */
-#endif
-#else
- 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
-
- buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
-#endif
- }
-
- /* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */
-
- glibtop_suid_leave (server);
+ /* XXX: the code here was, quite frankly, junk, and almost
+ * certainly wrong - remove it all, leave these fields
+ * unpopulated, and give up until such time as the right
+ * code is produced for both FreeBSD 4.x and 5.x
+ */
+ return;
}

View file

@ -0,0 +1,15 @@
--- src/daemon/gnuserv.c.orig Thu Nov 29 08:58:40 2001
+++ src/daemon/gnuserv.c Thu Nov 29 08:58:17 2001
@@ -200,6 +200,12 @@
auth_data_len = atoi (buf);
+ if (auth_data_len < 1 || auth_data_len > sizeof(buf)) {
+ syslog_message(LOG_WARNING,
+ "Invalid data length supplied by client");
+ return FALSE;
+ }
+
if (timed_read (fd, buf, auth_data_len, AUTH_TIMEOUT, 0) != auth_data_len)
return FALSE;

View file

@ -0,0 +1,17 @@
--- src/daemon/server.c.orig Mon Feb 17 15:22:19 2003
+++ src/daemon/server.c Mon Feb 17 15:23:31 2003
@@ -88,11 +88,12 @@
if (strcmp (uts.sysname, LIBGTOP_COMPILE_SYSTEM) ||
strcmp (uts.release, LIBGTOP_COMPILE_RELEASE) ||
strcmp (uts.machine, LIBGTOP_COMPILE_MACHINE)) {
- fprintf (stderr, "Can only run on %s %s %s\n",
+ fprintf (stderr, "This libgtop was compiled on %s %s %s\n",
LIBGTOP_COMPILE_SYSTEM,
LIBGTOP_COMPILE_RELEASE,
LIBGTOP_COMPILE_MACHINE);
- _exit (1);
+ fprintf (stderr, "If you see strange problems caused by it,\n");
+ fprintf (stderr, "you should recompile libgtop and dependent applications\n");
}
#endif

View file

@ -0,0 +1,138 @@
--- sysdeps/freebsd/proctime.c.orig Mon Nov 26 17:37:59 2001
+++ sysdeps/freebsd/proctime.c Wed Oct 2 21:26:35 2002
@@ -57,6 +57,7 @@
* system, and interrupt time usage.
*/
+#ifndef __FreeBSD__
static void
calcru(p, up, sp, ip)
struct proc *p;
@@ -66,9 +67,6 @@
{
quad_t totusec;
u_quad_t u, st, ut, it, tot;
-#if (__FreeBSD_version < 300003)
- long sec, usec;
-#endif
struct timeval tv;
st = p->p_sticks;
@@ -81,19 +79,10 @@
tot = 1;
}
-#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003)
-
- /* This was changed from a `struct timeval' into a `u_int64_t'
- * on FreeBSD 3.0 and renamed p_rtime -> p_runtime.
- */
-
- totusec = (u_quad_t) p->p_runtime;
-#else
sec = p->p_rtime.tv_sec;
usec = p->p_rtime.tv_usec;
totusec = (quad_t)sec * 1000000 + usec;
-#endif
if (totusec < 0) {
/* XXX no %qd in kernel. Truncate. */
@@ -116,6 +105,7 @@
ip->tv_usec = it % 1000000;
}
}
+#endif
/* Provides detailed information about a process. */
@@ -142,25 +132,25 @@
/* It does not work for the swapper task. */
if (pid == 0) return;
-#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
if (server->sysdeps.proc_time == 0)
return;
+#endif
#ifndef __bsdi__
sprintf (filename, "/proc/%d/mem", (int) pid);
if (stat (filename, &statb)) return;
#endif
-#endif
/* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1))
glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
-#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003)
- buf->rtime = pinfo [0].kp_proc.p_runtime;
+#if (defined __FreeBSD__) && (__FreeBSD_version >= 500013)
+ buf->rtime = pinfo [0].ki_runtime;
#else
- buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
+ buf->rtime = pinfo [0].kp_proc.p_runtime;
#endif
buf->frequency = 1000000;
@@ -192,6 +182,21 @@
buf->flags |= _glibtop_sysdeps_proc_time_user;
#else
+#if __FreeBSD_version >= 500013
+#if __FreeBSD_version >= 500016
+ if ((pinfo [0].ki_flag & PS_INMEM)) {
+#else
+ if ((pinfo [0].ki_flag & P_INMEM)) {
+#endif
+ buf->utime = pinfo [0].ki_runtime;
+ buf->stime = 0; /* XXX */
+ buf->cutime = tv2sec (pinfo [0].ki_childtime);
+ buf->cstime = 0; /* XXX */
+ buf->start_time = tv2sec (pinfo [0].ki_start);
+ buf->flags = _glibtop_sysdeps_proc_time_user;
+ }
+
+#else
glibtop_suid_enter (server);
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
@@ -199,29 +204,16 @@
(unsigned long) &u_addr->u_stats,
(char *) &pstats, sizeof (pstats)) == sizeof (pstats))
{
- /* This is taken form the kernel source code of
- * FreeBSD 2.2.6. */
-
- /* Well, we just do the same getrusage () does ... */
-
- register struct rusage *rup;
-
- glibtop_suid_leave (server);
-
- rup = &pstats.p_ru;
- calcru(&(pinfo [0]).kp_proc,
- &rup->ru_utime, &rup->ru_stime, NULL);
-
- buf->utime = tv2sec (pstats.p_ru.ru_utime);
- buf->stime = tv2sec (pstats.p_ru.ru_stime);
-
- buf->cutime = tv2sec (pstats.p_cru.ru_utime);
- buf->cstime = tv2sec (pstats.p_cru.ru_stime);
-
- buf->start_time = tv2sec (pstats.p_start);
+ buf->utime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_utime);
+ buf->stime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_stime);
+ buf->cutime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_utime);
+ buf->cstime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_stime);
+ buf->start_time = tv2sec (pinfo[0].kp_eproc.e_stats.p_start);
buf->flags = _glibtop_sysdeps_proc_time_user;
+ glibtop_suid_leave (server);
}
+#endif
glibtop_suid_leave (server);
#endif

View file

@ -0,0 +1,11 @@
--- sysdeps/freebsd/mem.c.orig Tue Jan 14 17:22:18 2003
+++ sysdeps/freebsd/mem.c Tue Jan 14 17:22:28 2003
@@ -75,7 +75,7 @@
/* MIB array for sysctl */
static int mib_length=2;
-#ifdef __bsdi__
+#ifndef VM_METER
static int mib [] = { CTL_VM, VM_TOTAL };
#else
static int mib [] = { CTL_VM, VM_METER };

View file

@ -0,0 +1,13 @@
--- sysdeps/freebsd/swap.c.orig Mon Aug 26 20:18:07 2002
+++ sysdeps/freebsd/swap.c Mon Aug 26 20:19:18 2002
@@ -369,8 +369,8 @@
buf->flags = _glibtop_sysdeps_swap;
- buf->used = kvmsw[nswdev].ksw_used;
- buf->total = kvmsw[nswdev].ksw_total;
+ buf->used = kvmsw[nswdev].ksw_used * getpagesize();
+ buf->total = kvmsw[nswdev].ksw_total * getpagesize();
buf->free = buf->total - buf->used;

View file

@ -0,0 +1,11 @@
--- sysdeps/guile/Makefile.in.orig Wed Jun 19 16:12:21 2002
+++ sysdeps/guile/Makefile.in Wed Jun 19 16:12:34 2002
@@ -516,7 +516,7 @@
mv gnc-t guile.c
guile.x: guile.c
- guile-snarf $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< > $@
+ guile-snarf -o $@ $< $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View file

@ -0,0 +1,11 @@
--- sysdeps/guile/names/Makefile.in.orig Wed Jun 19 16:13:02 2002
+++ sysdeps/guile/names/Makefile.in Wed Jun 19 16:13:12 2002
@@ -438,7 +438,7 @@
mv gnc-t guile-names.c
guile-names.x: guile-names.c
- guile-snarf $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< > $@
+ guile-snarf -o $@ $< $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

3
devel/libgtop/pkg-descr Normal file
View file

@ -0,0 +1,3 @@
This is library for the gtop, GNOME version of top command.
The top command is a tool to display and update information about the
top cpu processes.

111
devel/libgtop/pkg-plist Normal file
View file

@ -0,0 +1,111 @@
bin/libgtop-config
bin/libgtop_daemon
bin/libgtop_server
etc/libgtop-features.def
etc/libgtopConf.sh
include/libgtop-1.0/glibtop.h
include/libgtop-1.0/glibtop/close.h
include/libgtop-1.0/glibtop/command.h
include/libgtop-1.0/glibtop/cpu.h
include/libgtop-1.0/glibtop/error.h
include/libgtop-1.0/glibtop/fsusage.h
include/libgtop-1.0/glibtop/global.h
include/libgtop-1.0/glibtop/gnuserv.h
include/libgtop-1.0/glibtop/inodedb.h
include/libgtop-1.0/glibtop/loadavg.h
include/libgtop-1.0/glibtop/mem.h
include/libgtop-1.0/glibtop/mountlist.h
include/libgtop-1.0/glibtop/msg_limits.h
include/libgtop-1.0/glibtop/netload.h
include/libgtop-1.0/glibtop/open.h
include/libgtop-1.0/glibtop/parameter.h
include/libgtop-1.0/glibtop/ppp.h
include/libgtop-1.0/glibtop/procargs.h
include/libgtop-1.0/glibtop/prockernel.h
include/libgtop-1.0/glibtop/proclist.h
include/libgtop-1.0/glibtop/procmap.h
include/libgtop-1.0/glibtop/procmem.h
include/libgtop-1.0/glibtop/procsegment.h
include/libgtop-1.0/glibtop/procsignal.h
include/libgtop-1.0/glibtop/procstate.h
include/libgtop-1.0/glibtop/proctime.h
include/libgtop-1.0/glibtop/procuid.h
include/libgtop-1.0/glibtop/read.h
include/libgtop-1.0/glibtop/read_data.h
include/libgtop-1.0/glibtop/sem_limits.h
include/libgtop-1.0/glibtop/shm_limits.h
include/libgtop-1.0/glibtop/signal.h
include/libgtop-1.0/glibtop/swap.h
include/libgtop-1.0/glibtop/sysdeps.h
include/libgtop-1.0/glibtop/sysinfo.h
include/libgtop-1.0/glibtop/types.h
include/libgtop-1.0/glibtop/union.h
include/libgtop-1.0/glibtop/uptime.h
include/libgtop-1.0/glibtop/version.h
include/libgtop-1.0/glibtop/write.h
include/libgtop-1.0/glibtop/xmalloc.h
include/libgtop-1.0/glibtop_machine.h
include/libgtop-1.0/glibtop_server.h
include/libgtop-1.0/glibtop_suid.h
@unexec install-info --delete %D/info/libgtop.info %D/info/dir
info/libgtop.info
@exec install-info --section="Programming \& development tools" --entry="* libgtop: (libgtop). libgtop programming manual" %D/info/libgtop.info %D/info/dir
lib/libgtop.a
lib/libgtop.so
lib/libgtop.so.1
lib/libgtop_common.a
lib/libgtop_common.so
lib/libgtop_common.so.1
lib/libgtop_guile.a
lib/libgtop_guile.so
lib/libgtop_guile.so.1
lib/libgtop_guile_names.a
lib/libgtop_guile_names.so
lib/libgtop_guile_names.so.1
lib/libgtop_names.a
lib/libgtop_names.so
lib/libgtop_names.so.1
lib/libgtop_suid_common.a
lib/libgtop_suid_common.so
lib/libgtop_suid_common.so.1
lib/libgtop_sysdeps.a
lib/libgtop_sysdeps.so
lib/libgtop_sysdeps.so.1
lib/libgtop_sysdeps_suid.a
lib/libgtop_sysdeps_suid.so
lib/libgtop_sysdeps_suid.so.1
share/locale/az/LC_MESSAGES/libgtop.mo
share/locale/ca/LC_MESSAGES/libgtop.mo
share/locale/da/LC_MESSAGES/libgtop.mo
share/locale/de/LC_MESSAGES/libgtop.mo
share/locale/el/LC_MESSAGES/libgtop.mo
share/locale/es/LC_MESSAGES/libgtop.mo
share/locale/es_DO/LC_MESSAGES/libgtop.mo
share/locale/es_GT/LC_MESSAGES/libgtop.mo
share/locale/es_HN/LC_MESSAGES/libgtop.mo
share/locale/es_MX/LC_MESSAGES/libgtop.mo
share/locale/es_PA/LC_MESSAGES/libgtop.mo
share/locale/es_PE/LC_MESSAGES/libgtop.mo
share/locale/es_SV/LC_MESSAGES/libgtop.mo
share/locale/fi/LC_MESSAGES/libgtop.mo
share/locale/fr/LC_MESSAGES/libgtop.mo
share/locale/ga/LC_MESSAGES/libgtop.mo
share/locale/gl/LC_MESSAGES/libgtop.mo
share/locale/hu/LC_MESSAGES/libgtop.mo
share/locale/ja/LC_MESSAGES/libgtop.mo
share/locale/ko/LC_MESSAGES/libgtop.mo
share/locale/nl/LC_MESSAGES/libgtop.mo
share/locale/no/LC_MESSAGES/libgtop.mo
share/locale/pl/LC_MESSAGES/libgtop.mo
share/locale/pt/LC_MESSAGES/libgtop.mo
share/locale/pt_BR/LC_MESSAGES/libgtop.mo
share/locale/ru/LC_MESSAGES/libgtop.mo
share/locale/sk/LC_MESSAGES/libgtop.mo
share/locale/sl/LC_MESSAGES/libgtop.mo
share/locale/sv/LC_MESSAGES/libgtop.mo
share/locale/tr/LC_MESSAGES/libgtop.mo
share/locale/uk/LC_MESSAGES/libgtop.mo
share/locale/zh_CN.GB2312/LC_MESSAGES/libgtop.mo
share/locale/zh_TW/LC_MESSAGES/libgtop.mo
@dirrm include/libgtop-1.0/glibtop
@dirrm include/libgtop-1.0