summaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2003-11-15 04:08:22 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2003-11-15 04:08:22 +0800
commitf3ba293a22501795f4fc0c820df90449fed3a045 (patch)
tree03fad67a274cd8c997d5e193c5945de643cedfe6 /devel
parentd36bc2ee666da712d89569dfb5e079d6281c5044 (diff)
downloadmarcuscom-ports-f3ba293a22501795f4fc0c820df90449fed3a045.tar
marcuscom-ports-f3ba293a22501795f4fc0c820df90449fed3a045.tar.gz
marcuscom-ports-f3ba293a22501795f4fc0c820df90449fed3a045.tar.bz2
marcuscom-ports-f3ba293a22501795f4fc0c820df90449fed3a045.tar.lz
marcuscom-ports-f3ba293a22501795f4fc0c820df90449fed3a045.tar.xz
marcuscom-ports-f3ba293a22501795f4fc0c820df90449fed3a045.tar.zst
marcuscom-ports-f3ba293a22501795f4fc0c820df90449fed3a045.zip
Update to 2.5.0.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@1330 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'devel')
-rw-r--r--devel/libgtop2/Makefile36
-rw-r--r--devel/libgtop2/distinfo1
-rw-r--r--devel/libgtop2/files/patch-ah87
-rw-r--r--devel/libgtop2/files/patch-aj243
-rw-r--r--devel/libgtop2/files/patch-configure24
-rw-r--r--devel/libgtop2/files/patch-lib::command.c10
-rw-r--r--devel/libgtop2/files/patch-lib::lib.pl62
-rw-r--r--devel/libgtop2/files/patch-lib::read.c28
-rw-r--r--devel/libgtop2/files/patch-lib::write.c28
-rw-r--r--devel/libgtop2/files/patch-ltmain.sh42
-rw-r--r--devel/libgtop2/files/patch-src::daemon::io.c58
-rw-r--r--devel/libgtop2/files/patch-src_daemon_Makefile.in19
-rw-r--r--devel/libgtop2/files/patch-src_daemon_server.c17
-rw-r--r--devel/libgtop2/files/patch-sysdeps::freebsd::prockernel.c145
-rw-r--r--devel/libgtop2/files/patch-sysdeps::freebsd::procmem.c40
-rw-r--r--devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c153
-rw-r--r--devel/libgtop2/files/patch-sysdeps_freebsd_mem.c11
-rw-r--r--devel/libgtop2/files/patch-sysdeps_freebsd_netload.c81
-rw-r--r--devel/libgtop2/files/patch-sysdeps_freebsd_procargs.c11
-rw-r--r--devel/libgtop2/pkg-descr3
-rw-r--r--devel/libgtop2/pkg-plist117
21 files changed, 1216 insertions, 0 deletions
diff --git a/devel/libgtop2/Makefile b/devel/libgtop2/Makefile
new file mode 100644
index 000000000..cc0252027
--- /dev/null
+++ b/devel/libgtop2/Makefile
@@ -0,0 +1,36 @@
+# New ports collection makefile for: libgtop2
+# Date Created: 29 April 2002
+# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
+#
+# $FreeBSD: ports/devel/libgtop2/Makefile,v 1.77 2003/11/14 14:35:23 bland Exp $
+#
+
+PORTNAME= libgtop2
+PORTVERSION= 2.5.0
+CATEGORIES= devel gnome
+MASTER_SITES= ${MASTER_SITE_GNOME}
+MASTER_SITE_SUBDIR= sources/${PORTNAME:S/2$//}/2.5
+DISTNAME= libgtop-${PORTVERSION}
+DIST_SUBDIR= gnome2
+
+MAINTAINER= gnome@FreeBSD.org
+COMMENT= GNOME 2 top library
+
+USE_BZIP2= yes
+USE_X_PREFIX= yes
+USE_PERL5= yes
+USE_GMAKE= yes
+USE_GNOME= gnomehack libgnome
+USE_REINPLACE= yes
+INSTALLS_SHLIB= yes
+GNU_CONFIGURE= yes
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+
+INFO= libgtop2
+
+post-install:
+ @${CHGRP} kmem ${PREFIX}/bin/libgtop_server2
+ @${CHMOD} 2555 ${PREFIX}/bin/libgtop_server2
+
+.include <bsd.port.mk>
diff --git a/devel/libgtop2/distinfo b/devel/libgtop2/distinfo
new file mode 100644
index 000000000..00683e652
--- /dev/null
+++ b/devel/libgtop2/distinfo
@@ -0,0 +1 @@
+MD5 (gnome2/libgtop-2.5.0.tar.bz2) = 76c0a309157c08f2010c2f41e54b89a6
diff --git a/devel/libgtop2/files/patch-ah b/devel/libgtop2/files/patch-ah
new file mode 100644
index 000000000..87ff5c383
--- /dev/null
+++ b/devel/libgtop2/files/patch-ah
@@ -0,0 +1,87 @@
+--- sysdeps/freebsd/procmap.c.orig Mon Oct 20 11:19:50 2003
++++ sysdeps/freebsd/procmap.c Fri Nov 14 14:44:40 2003
+@@ -32,7 +32,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>
+@@ -90,8 +94,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;
+@@ -107,13 +112,19 @@
+
+ /* Get the process data */
+ 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 ((pinfo == NULL) || (count < 1)) {
++ glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
++ return NULL;
++ }
+
+ /* 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)");
+
+@@ -131,7 +142,7 @@
+
+ buf->total = buf->number * buf->size;
+
+- maps = g_malloc (server, buf->total);
++ maps = g_malloc (buf->total);
+
+ memset (maps, 0, buf->total);
+
+@@ -243,6 +254,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;
+
+@@ -251,13 +271,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);
+
diff --git a/devel/libgtop2/files/patch-aj b/devel/libgtop2/files/patch-aj
new file mode 100644
index 000000000..b7ea24eba
--- /dev/null
+++ b/devel/libgtop2/files/patch-aj
@@ -0,0 +1,243 @@
+--- sysdeps/freebsd/proclist.c.orig Thu May 27 23:04:05 1999
++++ sysdeps/freebsd/proclist.c Sun Sep 7 20:37:30 2003
+@@ -86,13 +86,24 @@
+ pids = glibtop_realloc_r (server, pids, count * sizeof (unsigned));
+ /* Copy the pids over to this chain */
+ 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 */
+ /* Set the fields in buf */
+ buf->number = j;
+--- sysdeps/freebsd/procstate.c.orig Sun Oct 17 03:01:39 1999
++++ sysdeps/freebsd/procstate.c Sun Sep 7 20:37:30 2003
+@@ -28,7 +28,7 @@
+ #include <glibtop_suid.h>
+
+ #if !defined(__OpenBSD__)
+-//&& (!defined __bsdi__)
++/*&& (!defined __bsdi__)*/
+ #include <sys/user.h>
+ #endif
+
+@@ -37,11 +37,7 @@
+ (1L << GLIBTOP_PROC_STATE_GID);
+
+ static const unsigned long _glibtop_sysdeps_proc_state_new =
+-#if LIBGTOP_VERSION_CODE >= 1001000
+-(1L << GLIBTOP_PROC_STATE_RUID) + (1L << GLIBTOP_PROC_STATE_RGID);
+-#else
+ 0;
+-#endif
+
+ /* Init function. */
+
+@@ -76,43 +72,35 @@
+ return;
+ }
+
+- strncpy (buf->cmd, pinfo [0].kp_proc.p_comm, sizeof (buf->cmd)-1);
+- buf->cmd [sizeof (buf->cmd)-1] = 0;
++#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
+
+- buf->uid = pinfo [0].kp_eproc.e_pcred.p_svuid;
+- buf->gid = pinfo [0].kp_eproc.e_pcred.p_svgid;
++#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
+
+-#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;
+ #endif
+
++ strncpy (buf->cmd, pinfo [0].XXX_P_COMM, sizeof (buf->cmd)-1);
++ buf->cmd [sizeof (buf->cmd)-1] = 0;
++
++ buf->uid = pinfo [0].XXX_P_SVUID;
++ buf->gid = pinfo [0].XXX_P_SVGID;
++
+ /* Set the flags for the data we're about to return*/
+ buf->flags = _glibtop_sysdeps_proc_state |
+ _glibtop_sysdeps_proc_state_new;
+
+-#if LIBGTOP_VERSION_CODE >= 1001000
+- switch (pinfo [0].kp_proc.p_stat) {
+- case SIDL:
+- buf->state = 0;
+- break;
+- case SRUN:
+- buf->state = GLIBTOP_PROCESS_RUNNING;
+- break;
+- case SSLEEP:
+- buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
+- break;
+- case SSTOP:
+- buf->state = GLIBTOP_PROCESS_STOPPED;
+- break;
+- case SZOMB:
+- buf->state = GLIBTOP_PROCESS_ZOMBIE;
+- break;
+- default:
+- return;
+- }
+-#else
+- switch (pinfo [0].kp_proc.p_stat) {
++ switch (pinfo [0].XXX_P_STAT) {
+ case SIDL:
+ buf->state = 'S';
+ break;
+@@ -131,7 +119,6 @@
+ default:
+ return;
+ }
+-#endif
+
+ buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE);
+ }
+--- sysdeps/freebsd/procuid.c.orig Fri Sep 17 06:08:07 1999
++++ sysdeps/freebsd/procuid.c Sun Sep 7 20:37:30 2003
+@@ -84,17 +84,46 @@
+ return;
+ }
+
+- 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;
+
+ /* Set the flags for the data we're about to return*/
+ buf->flags = _glibtop_sysdeps_proc_uid;
+--- sysdeps/freebsd/procsignal.c.orig Mon Feb 14 06:31:39 2000
++++ sysdeps/freebsd/procsignal.c Sun Sep 7 20:37:30 2003
+@@ -67,11 +67,27 @@
+ return;
+ }
+
++#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.
+ * pinfo [0].kp_proc.p_siglist
+ */
+ #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
+ buf->signal [0] = pinfo [0].kp_proc.p_siglist;
+ #endif
+@@ -80,7 +96,7 @@
+ * pinfo [0].kp_proc.p_sigmask
+ */
+ #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
+ buf->blocked [0] = pinfo [0].kp_proc.p_sigmask;
+ #endif
+@@ -89,7 +105,7 @@
+ * pinfo [0].kp_proc.p_sigignore
+ */
+ #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
+ buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore;
+ #endif
+@@ -98,7 +114,7 @@
+ * pinfo [0].kp_proc.p_sigcatch
+ */
+ #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
+ buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch;
+ #endif
diff --git a/devel/libgtop2/files/patch-configure b/devel/libgtop2/files/patch-configure
new file mode 100644
index 000000000..afb7c5b7f
--- /dev/null
+++ b/devel/libgtop2/files/patch-configure
@@ -0,0 +1,24 @@
+--- configure.orig Fri Nov 14 14:38:11 2003
++++ configure Fri Nov 14 15:01:39 2003
+@@ -1854,9 +1854,9 @@
+
+ # libtool versioning
+ LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION
+-LT_CURRENT=$LIBGTOP_CURRENT
+-LT_REVISION=$LIBGTOP_REVISION
+-LT_AGE=$LIBGTOP_AGE
++LT_CURRENT=2
++LT_REVISION=0
++LT_AGE=0
+ LT_VERSION_INFO="-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}"
+
+
+@@ -18326,7 +18326,7 @@
+
+
+ if test x$libgtop_need_server = xyes ; then
+- sysdeps_suid_lib="\$(top_builddir)/sysdeps/\$(sysdeps_dir)/libgtop_sysdeps_suid-2.0.la"
++ sysdeps_suid_lib="\$(top_builddir)/sysdeps/\$(sysdeps_dir)/libgtop_sysdeps_suid-2.0.la \$(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la"
+ server_programs='libgtop_server2'
+ else
+ sysdeps_suid_lib=
diff --git a/devel/libgtop2/files/patch-lib::command.c b/devel/libgtop2/files/patch-lib::command.c
new file mode 100644
index 000000000..4bb3aefb1
--- /dev/null
+++ b/devel/libgtop2/files/patch-lib::command.c
@@ -0,0 +1,10 @@
+--- lib/command.c.orig Tue Sep 9 09:47:58 2003
++++ lib/command.c Tue Sep 9 08:14:33 2003
+@@ -38,6 +38,7 @@
+ glibtop_init_r (&server, 0, 0);
+
+ memset (&cmnd, 0, sizeof (glibtop_command));
++ memset (&response, 0, sizeof (glibtop_response));
+
+ cmnd.command = command;
+
diff --git a/devel/libgtop2/files/patch-lib::lib.pl b/devel/libgtop2/files/patch-lib::lib.pl
new file mode 100644
index 000000000..6e08ba030
--- /dev/null
+++ b/devel/libgtop2/files/patch-lib::lib.pl
@@ -0,0 +1,62 @@
+--- lib/lib.pl.orig Mon Sep 1 20:17:45 2003
++++ lib/lib.pl Wed Sep 3 11:53:12 2003
+@@ -116,6 +116,8 @@
+ $param_decl = '';
+ $send_size = '';
+ $send_ptr = '';
++ $send_buf_decl = '';
++ $send_buf = '';
+ $nr_params = (@params = split(/:/, $param_def, 9999));
+ for ($param = 1; $param <= $nr_params; $param++) {
+ $list = $params[$param];
+@@ -135,28 +137,37 @@
+
+ $fields[$field];
+ $call_param = $call_param . ', ' . $fields[$field];
+- if ($send_ptr eq '') {
+- $send_ptr = "\n\tconst void *send_ptr = &" .
+-
+- $fields[$field] . ';';
+- }
+- if ($send_size eq '') {
+- $send_size = "\n\tconst size_t send_size =\n\t\t";
++ if ($send_buf eq '') {
++ $send_size = "\n\tconst size_t send_size = ";
++ $send_ptr = "\n\tconst void *send_ptr = &";
++ if ($nr_params == 1 && $count == 1) {
++ $send_size = $send_size . 'sizeof (' . $fields[$field] . ');';
++ $send_ptr = $send_ptr . $fields[$field] . ';';
++ last;
++ }
++ $send_size = $send_size . 'sizeof (send_buf);';
++ $send_ptr = $send_ptr . 'send_buf;';
+ }
+ else {
+- $send_size = $send_size . ' + ';
++ $send_buf_decl = $send_buf_decl . ' ';
++ $send_buf = $send_buf . ', ';
+ }
+- $send_size = $send_size . 'sizeof (' . $fields[$field] . ')';
++ $send_buf_decl = $send_buf_decl . '' . $convert{$type} . ' ' .
++
++ $fields[$field] . ';';
++ $send_buf = $send_buf . '' . $fields[$field];
+ }
+ }
+- if ($send_size ne '') {
+- $send_size = $send_size . ';';
+- }
+- else {
++ if ($send_size eq '') {
+ $send_size = "\n\tconst size_t send_size = 0;";
+ }
+ if ($send_ptr eq '') {
+ $send_ptr = "\n\tconst void *send_ptr = NULL;";
++ }
++ if ($send_buf ne '') {
++ $send_ptr = "\n\tconst struct { " . $send_buf_decl . " } send_buf =\n" .
++ "\t\t{ " . $send_buf . ' };' .
++ $send_ptr;
+ }
+ }
+
diff --git a/devel/libgtop2/files/patch-lib::read.c b/devel/libgtop2/files/patch-lib::read.c
new file mode 100644
index 000000000..38583f876
--- /dev/null
+++ b/devel/libgtop2/files/patch-lib::read.c
@@ -0,0 +1,28 @@
+--- lib/read.c.orig Mon Oct 20 11:19:41 2003
++++ lib/read.c Fri Nov 14 14:37:00 2003
+@@ -22,6 +22,7 @@
+ */
+
+ #include <config.h>
++#include <errno.h>
+ #include <glibtop/read.h>
+ #include <libgnome/gnome-i18n.h>
+
+@@ -68,12 +69,16 @@
+ fprintf (stderr, "LIBRARY: really reading %d bytes.\n", size);
+ #endif
+
++retry:
+ if (server->socket) {
+ do_read (server->socket, buf, size);
+ } else {
+ ret = read (server->input [0], buf, size);
+ }
+
+- if (ret < 0)
++ if (ret < 0) {
++ if (errno == EINTR)
++ goto retry;
+ glibtop_error_io_r (server, _("read %d bytes"), size);
++ }
+ }
diff --git a/devel/libgtop2/files/patch-lib::write.c b/devel/libgtop2/files/patch-lib::write.c
new file mode 100644
index 000000000..45c2434ea
--- /dev/null
+++ b/devel/libgtop2/files/patch-lib::write.c
@@ -0,0 +1,28 @@
+--- lib/write.c.orig Mon Sep 8 23:05:01 2003
++++ lib/write.c Tue Sep 9 10:04:37 2003
+@@ -21,6 +21,7 @@
+ Boston, MA 02111-1307, USA.
+ */
+
++#include <errno.h>
+ #include <glibtop/write.h>
+
+ /* Writes some data to server. */
+@@ -38,12 +39,16 @@
+ fprintf (stderr, "LIBRARY: really writing %d bytes.\n", size);
+ #endif
+
++retry:
+ if (server->socket) {
+ ret = send (server->socket, buf, size, 0);
+ } else {
+ ret = write (server->output [1], buf, size);
+ }
+
+- if (ret < 0)
++ if (ret < 0) {
++ if (errno == EINTR)
++ goto retry;
+ glibtop_error_io_r (server, _("write %d bytes"), size);
++ }
+ }
diff --git a/devel/libgtop2/files/patch-ltmain.sh b/devel/libgtop2/files/patch-ltmain.sh
new file mode 100644
index 000000000..54bbcbc57
--- /dev/null
+++ b/devel/libgtop2/files/patch-ltmain.sh
@@ -0,0 +1,42 @@
+--- ltmain.sh.orig Sun Aug 24 18:53:15 2003
++++ ltmain.sh Sun Aug 24 18:57:42 2003
+@@ -1060,8 +1060,16 @@
+ continue
+ ;;
+
++ -pthread)
++ compile_command="$compile_command -pthread"
++ finalize_command="$finalize_command -pthread"
++ compiler_command="$compiler_flags -pthread"
++ continue
++ ;;
++
+ -module)
+ module=yes
++ build_old_libs=no
+ continue
+ ;;
+
+@@ -2444,6 +2452,9 @@
+ *-*-openbsd*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
++ *-*-freebsd*)
++ # FreeBSD doesn't need this...
++ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test $build_libtool_need_lc = "yes"; then
+@@ -4210,10 +4221,12 @@
+ fi
+
+ # Install the pseudo-library for information purposes.
++ if /usr/bin/false; then
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
++ fi
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
diff --git a/devel/libgtop2/files/patch-src::daemon::io.c b/devel/libgtop2/files/patch-src::daemon::io.c
new file mode 100644
index 000000000..b4079dec1
--- /dev/null
+++ b/devel/libgtop2/files/patch-src::daemon::io.c
@@ -0,0 +1,58 @@
+--- src/daemon/io.c.orig Tue Sep 9 09:51:15 2003
++++ src/daemon/io.c Tue Sep 9 10:07:10 2003
+@@ -21,6 +21,7 @@
+ Boston, MA 02111-1307, USA.
+ */
+
++#include <errno.h>
+ #include "daemon.h"
+
+ void
+@@ -35,9 +36,13 @@
+ resp->offset = offset;
+ resp->data_size = data_size;
+
++retry1:
+ if (s == 0) {
+- if (write (1, (const void *) resp, sizeof (glibtop_response)) < 0)
++ if (write (1, (const void *) resp, sizeof (glibtop_response)) < 0) {
++ if (errno == EINTR)
++ goto retry1;
+ glibtop_warn_io ("write");
++ }
+ } else {
+ if (send (s, (const void *) resp, sizeof (glibtop_response), 0) < 0)
+ glibtop_warn_io ("send");
+@@ -47,10 +52,13 @@
+ #ifdef REAL_DEBUG
+ fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size);
+ #endif
+-
++retry2:
+ if (s == 0) {
+- if (write (1, data, resp->data_size) < 0)
++ if (write (1, data, resp->data_size) < 0) {
++ if (errno == EINTR)
++ goto retry2;
+ glibtop_warn_io ("write");
++ }
+ } else {
+ if (send (s, data, resp->data_size, 0) , 0)
+ glibtop_warn_io ("send");
+@@ -66,6 +74,7 @@
+ size_t already_read = 0, remaining = total_size;
+
+ while (already_read < total_size) {
++retry:
+ if (s)
+ nread = recv (s, ptr, remaining, 0);
+ else
+@@ -77,6 +86,8 @@
+ }
+
+ if (nread <= 0) {
++ if (errno == EINTR)
++ goto retry;
+ glibtop_warn_io ("recv");
+ return 0;
+ }
diff --git a/devel/libgtop2/files/patch-src_daemon_Makefile.in b/devel/libgtop2/files/patch-src_daemon_Makefile.in
new file mode 100644
index 000000000..5af32511c
--- /dev/null
+++ b/devel/libgtop2/files/patch-src_daemon_Makefile.in
@@ -0,0 +1,19 @@
+--- src/daemon/Makefile.in.orig Fri Nov 14 14:38:11 2003
++++ src/daemon/Makefile.in Fri Nov 14 14:59:16 2003
+@@ -86,7 +86,7 @@
+ LIBGTOP_EXTRA_LIBS = @LIBGTOP_EXTRA_LIBS@
+ LIBGTOP_INCS = @LIBGTOP_INCS@
+ LIBGTOP_INTERFACE_AGE = @LIBGTOP_INTERFACE_AGE@
+-LIBGTOP_LIBS = @LIBGTOP_LIBS@
++LIBGTOP_LIBS =
+ LIBGTOP_MAJOR_VERSION = @LIBGTOP_MAJOR_VERSION@
+ LIBGTOP_MICRO_VERSION = @LIBGTOP_MICRO_VERSION@
+ LIBGTOP_MINOR_VERSION = @LIBGTOP_MINOR_VERSION@
+@@ -160,6 +160,7 @@
+ @sysdeps_suid_lib@ \
+ $(suid_sysdeps) $(suid_common)\
+ $(LIBGTOP_LIBS)\
++ $(GLIB_LIBS) \
+ @libs_xauth@
+
+
diff --git a/devel/libgtop2/files/patch-src_daemon_server.c b/devel/libgtop2/files/patch-src_daemon_server.c
new file mode 100644
index 000000000..bf0bba5c7
--- /dev/null
+++ b/devel/libgtop2/files/patch-src_daemon_server.c
@@ -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
+
diff --git a/devel/libgtop2/files/patch-sysdeps::freebsd::prockernel.c b/devel/libgtop2/files/patch-sysdeps::freebsd::prockernel.c
new file mode 100644
index 000000000..396ae9c8d
--- /dev/null
+++ b/devel/libgtop2/files/patch-sysdeps::freebsd::prockernel.c
@@ -0,0 +1,145 @@
+--- sysdeps/freebsd/prockernel.c.orig Sun Oct 17 03:31:43 1999
++++ sysdeps/freebsd/prockernel.c Tue Sep 9 11:36:35 2003
+@@ -34,12 +34,6 @@
+ #if (!defined __OpenBSD__) && (!defined __bsdi__)
+ #include <sys/user.h>
+ #endif
+-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__))
+-#include <machine/pcb.h>
+-#endif
+-#if defined(__FreeBSD__) && !defined(__alpha__)
+-#include <machine/tss.h>
+-#endif
+
+ #include <unistd.h>
+ #include <fcntl.h>
+@@ -78,14 +72,8 @@
+ pid_t pid)
+ {
+ 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);
+
+ memset (buf, 0, sizeof (glibtop_proc_kernel));
+@@ -98,14 +86,30 @@
+
+ /* 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 ((pinfo == NULL) || (count != 1)) {
++ glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
++ return;
++ }
++
++#if __FreeBSD_version >= 500013
++
++#define XXX_P_WCHAN ki_wchan
++#define XXX_P_WMESG ki_wmesg
++#define XXX_E_WMESG ki_wmesg
+
+- buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
++#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);
+ buf->wchan [sizeof (buf->wchan) - 1] = 0;
+ buf->flags |= (1L << GLIBTOP_PROC_KERNEL_WCHAN);
+@@ -113,72 +117,10 @@
+ buf->wchan [0] = 0;
+ }
+
+- /* 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;
+ }
diff --git a/devel/libgtop2/files/patch-sysdeps::freebsd::procmem.c b/devel/libgtop2/files/patch-sysdeps::freebsd::procmem.c
new file mode 100644
index 000000000..a174fda33
--- /dev/null
+++ b/devel/libgtop2/files/patch-sysdeps::freebsd::procmem.c
@@ -0,0 +1,40 @@
+--- sysdeps/freebsd/procmem.c.orig Fri May 28 03:56:49 1999
++++ sysdeps/freebsd/procmem.c Sun Sep 7 21:37:38 2003
+@@ -137,6 +137,23 @@
+ return;
+ }
+
++#if __FreeBSD_version >= 500013
++
++#define XXX_P_VMSPACE ki_vmspace
++
++ buf->rss_rlim = pinfo [0].ki_rssize;
++
++ buf->vsize = (u_int64_t) pinfo [0].ki_size;
++ 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,
+ (unsigned long) pinfo [0].kp_proc.p_limit,
+ (char *) &plimit, sizeof (plimit)) != sizeof (plimit)) {
+@@ -154,11 +171,12 @@
+
+ buf->resident = buf->rss = (u_int64_t) pagetok
+ (vms->vm_rssize) << LOG1024;
++#endif
+
+ /* Now we get the shared memory. */
+
+ 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)) {
+ glibtop_warn_io_r (server, "kvm_read (vmspace)");
+ return;
diff --git a/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c b/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c
new file mode 100644
index 000000000..8905fd21b
--- /dev/null
+++ b/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c
@@ -0,0 +1,153 @@
+--- sysdeps/freebsd/proctime.c.orig Thu Feb 15 06:36:42 2001
++++ sysdeps/freebsd/proctime.c Tue Sep 9 11:17:56 2003
+@@ -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. */
+
+@@ -132,9 +122,6 @@
+ struct pstats pstats;
+ int count;
+
+- char filename [BUFSIZ];
+- struct stat statb;
+-
+ glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0);
+
+ memset (buf, 0, sizeof (glibtop_proc_time));
+@@ -142,25 +129,23 @@
+ /* 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;
+
+-#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 ((pinfo == NULL) || (count != 1)) {
++ glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
++ return;
++ }
+
+-#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 +177,21 @@
+
+ buf->flags |= _glibtop_sysdeps_proc_time_user;
+ #else
++#if __FreeBSD_version >= 500013
++#if __FreeBSD_version >= 500016
++ if ((pinfo [0].ki_sflag & 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,31 +199,17 @@
+ (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;
+
++ 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);
+-
+- 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->flags = _glibtop_sysdeps_proc_time_user;
+ }
+-
+ glibtop_suid_leave (server);
++#endif
+ #endif
+ }
+
diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_mem.c b/devel/libgtop2/files/patch-sysdeps_freebsd_mem.c
new file mode 100644
index 000000000..2aa4b7534
--- /dev/null
+++ b/devel/libgtop2/files/patch-sysdeps_freebsd_mem.c
@@ -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 };
diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_netload.c b/devel/libgtop2/files/patch-sysdeps_freebsd_netload.c
new file mode 100644
index 000000000..0e72ddb78
--- /dev/null
+++ b/devel/libgtop2/files/patch-sysdeps_freebsd_netload.c
@@ -0,0 +1,81 @@
+--- sysdeps/freebsd/netload.c.orig Mon Oct 20 01:55:32 2003
++++ sysdeps/freebsd/netload.c Fri Nov 14 23:09:15 2003
+@@ -83,6 +83,7 @@
+ u_long ifnetaddr, ifnetfound, ifaddraddr;
+ struct sockaddr *sa;
+ char tname [16];
++ char temp [16];
+
+ union {
+ struct ifaddr ifa;
+@@ -109,10 +110,13 @@
+ sizeof (ifnet)) != sizeof (ifnet))
+ glibtop_error_io_r (server, "kvm_read (ifnetaddr)");
+
+-#if defined(__FreeBSD__) || defined(__bsdi__)
++#if (defined(__FreeBSD__) && (__FreeBSD_version < 501113)) || defined(__bsdi__)
+ if (kvm_read (server->machine.kd, (u_long) ifnet.if_name,
+ tname, 16) != 16)
+ glibtop_error_io_r (server, "kvm_read (if_name)");
++ snprintf(temp, (15 - strlen(tname)), "%d", ifnet.if_unit);
++ strcat(tname, temp);
++ tname [15] = 0;
+ #else
+ strncpy (tname, ifnet.if_xname, 16);
+ tname [15] = 0;
+@@ -140,39 +144,39 @@
+ sin = (struct sockaddr_in *)sa;
+
+ if (ifnet.if_flags & IFF_UP)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_UP;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_UP);
+ if (ifnet.if_flags & IFF_BROADCAST)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_BROADCAST;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_BROADCAST);
+ if (ifnet.if_flags & IFF_DEBUG)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_DEBUG;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_DEBUG);
+ if (ifnet.if_flags & IFF_LOOPBACK)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_LOOPBACK;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK);
+ if (ifnet.if_flags & IFF_POINTOPOINT)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_POINTOPOINT;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT);
+ if (ifnet.if_flags & IFF_RUNNING)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_RUNNING;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING);
+ if (ifnet.if_flags & IFF_NOARP)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_NOARP;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP);
+ if (ifnet.if_flags & IFF_PROMISC)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_PROMISC;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC);
+ if (ifnet.if_flags & IFF_ALLMULTI)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_ALLMULTI;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI);
+ if (ifnet.if_flags & IFF_OACTIVE)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_OACTIVE;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_OACTIVE);
+ if (ifnet.if_flags & IFF_SIMPLEX)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_SIMPLEX;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_SIMPLEX);
+ if (ifnet.if_flags & IFF_LINK0)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_LINK0;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LINK0);
+ if (ifnet.if_flags & IFF_LINK1)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_LINK1;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LINK1);
+ if (ifnet.if_flags & IFF_LINK2)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_LINK2;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LINK2);
+ #ifdef __FreeBSD__
+ if (ifnet.if_flags & IFF_ALTPHYS)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_ALTPHYS;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALTPHYS);
+ #endif
+ if (ifnet.if_flags & IFF_MULTICAST)
+- buf->if_flags |= GLIBTOP_IF_FLAGS_MULTICAST;
++ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST);
+
+ #if !defined(__bsdi__)
+ /* Commenting out to "fix" #13345. */
diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_procargs.c b/devel/libgtop2/files/patch-sysdeps_freebsd_procargs.c
new file mode 100644
index 000000000..5ebfdba82
--- /dev/null
+++ b/devel/libgtop2/files/patch-sysdeps_freebsd_procargs.c
@@ -0,0 +1,11 @@
+--- sysdeps/freebsd/procargs.c.orig Fri Nov 14 14:39:42 2003
++++ sysdeps/freebsd/procargs.c Fri Nov 14 14:43:40 2003
+@@ -93,7 +93,7 @@
+ size += strlen (*ptr)+1;
+
+ size += 2;
+- retval = g_malloc (server, size);
++ retval = g_malloc (size);
+ memset (retval, 0, size);
+
+ for (ptr = args; *ptr; ptr++) {
diff --git a/devel/libgtop2/pkg-descr b/devel/libgtop2/pkg-descr
new file mode 100644
index 000000000..be81b3b48
--- /dev/null
+++ b/devel/libgtop2/pkg-descr
@@ -0,0 +1,3 @@
+This is library for the gtop2, the GNOME 2.0 version of top command.
+The top command is a tool to display and update information about the
+top cpu processes.
diff --git a/devel/libgtop2/pkg-plist b/devel/libgtop2/pkg-plist
new file mode 100644
index 000000000..c111cd7fe
--- /dev/null
+++ b/devel/libgtop2/pkg-plist
@@ -0,0 +1,117 @@
+bin/libgtop_daemon2
+bin/libgtop_server2
+include/libgtop-2.0/glibtop.h
+include/libgtop-2.0/glibtop/close.h
+include/libgtop-2.0/glibtop/command.h
+include/libgtop-2.0/glibtop/cpu.h
+include/libgtop-2.0/glibtop/error.h
+include/libgtop-2.0/glibtop/fsusage.h
+include/libgtop-2.0/glibtop/global.h
+include/libgtop-2.0/glibtop/gnuserv.h
+include/libgtop-2.0/glibtop/inodedb.h
+include/libgtop-2.0/glibtop/loadavg.h
+include/libgtop-2.0/glibtop/mem.h
+include/libgtop-2.0/glibtop/mountlist.h
+include/libgtop-2.0/glibtop/msg_limits.h
+include/libgtop-2.0/glibtop/netload.h
+include/libgtop-2.0/glibtop/open.h
+include/libgtop-2.0/glibtop/parameter.h
+include/libgtop-2.0/glibtop/ppp.h
+include/libgtop-2.0/glibtop/procargs.h
+include/libgtop-2.0/glibtop/prockernel.h
+include/libgtop-2.0/glibtop/proclist.h
+include/libgtop-2.0/glibtop/procmap.h
+include/libgtop-2.0/glibtop/procmem.h
+include/libgtop-2.0/glibtop/procsegment.h
+include/libgtop-2.0/glibtop/procsignal.h
+include/libgtop-2.0/glibtop/procstate.h
+include/libgtop-2.0/glibtop/proctime.h
+include/libgtop-2.0/glibtop/procuid.h
+include/libgtop-2.0/glibtop/read.h
+include/libgtop-2.0/glibtop/read_data.h
+include/libgtop-2.0/glibtop/sem_limits.h
+include/libgtop-2.0/glibtop/shm_limits.h
+include/libgtop-2.0/glibtop/signal.h
+include/libgtop-2.0/glibtop/swap.h
+include/libgtop-2.0/glibtop/sysdeps.h
+include/libgtop-2.0/glibtop/sysinfo.h
+include/libgtop-2.0/glibtop/types.h
+include/libgtop-2.0/glibtop/union.h
+include/libgtop-2.0/glibtop/uptime.h
+include/libgtop-2.0/glibtop/version.h
+include/libgtop-2.0/glibtop/write.h
+include/libgtop-2.0/glibtop_machine.h
+include/libgtop-2.0/glibtop_server.h
+include/libgtop-2.0/glibtop_suid.h
+lib/libgtop-2.0.a
+lib/libgtop-2.0.so
+lib/libgtop-2.0.so.2
+lib/libgtop_common-2.0.a
+lib/libgtop_common-2.0.so
+lib/libgtop_common-2.0.so.2
+lib/libgtop_names-2.0.a
+lib/libgtop_names-2.0.so
+lib/libgtop_names-2.0.so.2
+lib/libgtop_suid_common-2.0.a
+lib/libgtop_suid_common-2.0.so
+lib/libgtop_suid_common-2.0.so.2
+lib/libgtop_sysdeps-2.0.a
+lib/libgtop_sysdeps-2.0.so
+lib/libgtop_sysdeps-2.0.so.2
+lib/libgtop_sysdeps_suid-2.0.a
+lib/libgtop_sysdeps_suid-2.0.so
+lib/libgtop_sysdeps_suid-2.0.so.2
+libdata/pkgconfig/libgtop-2.0.pc
+share/locale/am/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ar/LC_MESSAGES/libgtop-2.0.mo
+share/locale/az/LC_MESSAGES/libgtop-2.0.mo
+share/locale/be/LC_MESSAGES/libgtop-2.0.mo
+share/locale/bg/LC_MESSAGES/libgtop-2.0.mo
+share/locale/bn/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ca/LC_MESSAGES/libgtop-2.0.mo
+share/locale/cs/LC_MESSAGES/libgtop-2.0.mo
+share/locale/cy/LC_MESSAGES/libgtop-2.0.mo
+share/locale/da/LC_MESSAGES/libgtop-2.0.mo
+share/locale/de/LC_MESSAGES/libgtop-2.0.mo
+share/locale/el/LC_MESSAGES/libgtop-2.0.mo
+share/locale/es/LC_MESSAGES/libgtop-2.0.mo
+share/locale/et/LC_MESSAGES/libgtop-2.0.mo
+share/locale/fa/LC_MESSAGES/libgtop-2.0.mo
+share/locale/fi/LC_MESSAGES/libgtop-2.0.mo
+share/locale/fr/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ga/LC_MESSAGES/libgtop-2.0.mo
+share/locale/gl/LC_MESSAGES/libgtop-2.0.mo
+share/locale/he/LC_MESSAGES/libgtop-2.0.mo
+share/locale/hi/LC_MESSAGES/libgtop-2.0.mo
+share/locale/hu/LC_MESSAGES/libgtop-2.0.mo
+share/locale/id/LC_MESSAGES/libgtop-2.0.mo
+share/locale/it/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ja/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ko/LC_MESSAGES/libgtop-2.0.mo
+share/locale/lv/LC_MESSAGES/libgtop-2.0.mo
+share/locale/mk/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ml/LC_MESSAGES/libgtop-2.0.mo
+share/locale/mn/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ms/LC_MESSAGES/libgtop-2.0.mo
+share/locale/nl/LC_MESSAGES/libgtop-2.0.mo
+share/locale/nn/LC_MESSAGES/libgtop-2.0.mo
+share/locale/no/LC_MESSAGES/libgtop-2.0.mo
+share/locale/pl/LC_MESSAGES/libgtop-2.0.mo
+share/locale/pt/LC_MESSAGES/libgtop-2.0.mo
+share/locale/pt_BR/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ro/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ru/LC_MESSAGES/libgtop-2.0.mo
+share/locale/sk/LC_MESSAGES/libgtop-2.0.mo
+share/locale/sl/LC_MESSAGES/libgtop-2.0.mo
+share/locale/sq/LC_MESSAGES/libgtop-2.0.mo
+share/locale/sr/LC_MESSAGES/libgtop-2.0.mo
+share/locale/sr@Latn/LC_MESSAGES/libgtop-2.0.mo
+share/locale/sv/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ta/LC_MESSAGES/libgtop-2.0.mo
+share/locale/tr/LC_MESSAGES/libgtop-2.0.mo
+share/locale/uk/LC_MESSAGES/libgtop-2.0.mo
+share/locale/vi/LC_MESSAGES/libgtop-2.0.mo
+share/locale/zh_CN/LC_MESSAGES/libgtop-2.0.mo
+share/locale/zh_TW/LC_MESSAGES/libgtop-2.0.mo
+@dirrm include/libgtop-2.0/glibtop
+@dirrm include/libgtop-2.0