summaryrefslogtreecommitdiffstats
path: root/devel/libgtop
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2009-03-02 08:41:26 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2009-03-02 08:41:26 +0800
commit6462cf90c9acc2909875ae1bbe273620fe005aee (patch)
tree75e466e970f6cdc243894e0b56a95ba7ee9fbf5e /devel/libgtop
parent9c7afef90b01c548e52199753111c7a388e12244 (diff)
downloadmarcuscom-ports-6462cf90c9acc2909875ae1bbe273620fe005aee.tar
marcuscom-ports-6462cf90c9acc2909875ae1bbe273620fe005aee.tar.gz
marcuscom-ports-6462cf90c9acc2909875ae1bbe273620fe005aee.tar.bz2
marcuscom-ports-6462cf90c9acc2909875ae1bbe273620fe005aee.tar.lz
marcuscom-ports-6462cf90c9acc2909875ae1bbe273620fe005aee.tar.xz
marcuscom-ports-6462cf90c9acc2909875ae1bbe273620fe005aee.tar.zst
marcuscom-ports-6462cf90c9acc2909875ae1bbe273620fe005aee.zip
Update to 2.26.0.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@11978 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'devel/libgtop')
-rw-r--r--devel/libgtop/Makefile49
-rw-r--r--devel/libgtop/distinfo3
-rw-r--r--devel/libgtop/files/patch-config.h.in12
-rw-r--r--devel/libgtop/files/patch-configure81
-rw-r--r--devel/libgtop/files/patch-libgtop-sysdeps.m412
-rw-r--r--devel/libgtop/files/patch-src_daemon_server.c17
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_Makefile.am17
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_Makefile.in43
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_nosuid.c19
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_open.c91
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_procopenfiles.c59
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_procwd.c58
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_suid_open.c94
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_sysinfo.c13
-rw-r--r--devel/libgtop/files/pkg-message13
-rw-r--r--devel/libgtop/pkg-descr3
-rw-r--r--devel/libgtop/pkg-plist205
17 files changed, 789 insertions, 0 deletions
diff --git a/devel/libgtop/Makefile b/devel/libgtop/Makefile
new file mode 100644
index 000000000..5ba509199
--- /dev/null
+++ b/devel/libgtop/Makefile
@@ -0,0 +1,49 @@
+# New ports collection makefile for: libgtop2
+# Date Created: 29 April 2002
+# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
+#
+# $FreeBSD$
+# $MCom: ports/devel/libgtop/Makefile,v 1.45 2009/01/10 01:59:21 mezz Exp $
+#
+
+PORTNAME= libgtop
+PORTVERSION= 2.26.0
+CATEGORIES= devel gnome
+MASTER_SITES= GNOME
+DIST_SUBDIR= gnome2
+
+MAINTAINER= gnome@FreeBSD.org
+COMMENT= GNOME 2 top library
+
+USE_BZIP2= yes
+USE_PERL5_BUILD=yes
+USE_GETTEXT= yes
+USE_GMAKE= yes
+USE_GNOME= gnomehack glib20 ltverhack intlhack
+USE_LDCONFIG= yes
+USE_AUTOTOOLS= libtool:15
+CONFIGURE_ARGS= --disable-gtk-doc \
+ --with-html-dir=${PREFIX}/share/doc
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+
+INFO= libgtop2
+
+PKGMESSAGE= ${FILESDIR}/pkg-message
+
+.include <bsd.port.pre.mk>
+
+.if ( ${OSVERSION} >= 800000 && ${OSVERSION} < 800019 ) || \
+ ${OSVERSION} < 700104
+RUN_DEPENDS+= lsof:${PORTSDIR}/sysutils/lsof
+.endif
+
+post-patch:
+ @${FIND} ${WRKSRC} -type f | ${XARGS} ${TOUCH} -f
+
+post-install:
+ @${CHGRP} kmem ${PREFIX}/bin/libgtop_server2
+ @${CHMOD} 2555 ${PREFIX}/bin/libgtop_server2
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.post.mk>
diff --git a/devel/libgtop/distinfo b/devel/libgtop/distinfo
new file mode 100644
index 000000000..6bcefcbda
--- /dev/null
+++ b/devel/libgtop/distinfo
@@ -0,0 +1,3 @@
+MD5 (gnome2/libgtop-2.26.0.tar.bz2) = a51ff49eddcce4573f7385e4be33158a
+SHA256 (gnome2/libgtop-2.26.0.tar.bz2) = acc11d54614722a752a44237b5e11e9d6508da82c6d7ad25bf97156f5e28a7fd
+SIZE (gnome2/libgtop-2.26.0.tar.bz2) = 791512
diff --git a/devel/libgtop/files/patch-config.h.in b/devel/libgtop/files/patch-config.h.in
new file mode 100644
index 000000000..8fc4a10b1
--- /dev/null
+++ b/devel/libgtop/files/patch-config.h.in
@@ -0,0 +1,12 @@
+--- config.h.in.orig 2008-12-06 16:05:23.000000000 -0500
++++ config.h.in 2008-12-06 16:05:27.000000000 -0500
+@@ -115,6 +115,9 @@
+ /* defined if you have linux/isdn.h */
+ #undef HAVE_ISDN_H
+
++/* Define if you have the kinfo_getfile function */
++#undef HAVE_KINFO_GETFILE
++
+ /* Define to 1 if you have the `lchown' function. */
+ #undef HAVE_LCHOWN
+
diff --git a/devel/libgtop/files/patch-configure b/devel/libgtop/files/patch-configure
new file mode 100644
index 000000000..800116d44
--- /dev/null
+++ b/devel/libgtop/files/patch-configure
@@ -0,0 +1,81 @@
+--- configure.orig 2009-01-13 01:39:39.000000000 -0500
++++ configure 2009-01-13 01:45:25.000000000 -0500
+@@ -21745,6 +21745,78 @@ fi
+ if test -n "${osreldate}" && test ${osreldate} -ge 600000 ; then
+ EXTRA_SYSDEPS_LIBS="-lgeom -ldevstat"
+ fi
++ { echo "$as_me:$LINENO: checking for kinfo_getfile in -lutil" >&5
++echo $ECHO_N "checking for kinfo_getfile in -lutil... $ECHO_C" >&6; }
++if test "${ac_cv_lib_util_kinfo_getfile+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ ac_check_lib_save_LIBS=$LIBS
++LIBS="-lutil $LIBS"
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++
++/* Override any GCC internal prototype to avoid an error.
++ Use char because int might match the return type of a GCC
++ builtin and then its argument prototype would still apply. */
++#ifdef __cplusplus
++extern "C"
++#endif
++char kinfo_getfile ();
++int
++main ()
++{
++return kinfo_getfile ();
++ ;
++ return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext conftest$ac_exeext
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++ *) ac_try_echo=$ac_try;;
++esac
++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++ (eval "$ac_link") 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } && {
++ test -z "$ac_c_werror_flag" ||
++ test ! -s conftest.err
++ } && test -s conftest$ac_exeext &&
++ $as_test_x conftest$ac_exeext; then
++ ac_cv_lib_util_kinfo_getfile=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ ac_cv_lib_util_kinfo_getfile=no
++fi
++
++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
++ conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_kinfo_getfile" >&5
++echo "${ECHO_T}$ac_cv_lib_util_kinfo_getfile" >&6; }
++if test $ac_cv_lib_util_kinfo_getfile = yes; then
++ EXTRA_SYSDEPS_LIBS="${EXTRA_SYSDEPS_LIBS} -lutil"
++
++cat >>confdefs.h <<\_ACEOF
++#define HAVE_KINFO_GETFILE 1
++_ACEOF
++
++else
++ :
++fi
++
+ ;;
+ esac
+
diff --git a/devel/libgtop/files/patch-libgtop-sysdeps.m4 b/devel/libgtop/files/patch-libgtop-sysdeps.m4
new file mode 100644
index 000000000..1805da02a
--- /dev/null
+++ b/devel/libgtop/files/patch-libgtop-sysdeps.m4
@@ -0,0 +1,12 @@
+--- libgtop-sysdeps.m4.orig 2008-04-21 14:58:38.000000000 -0400
++++ libgtop-sysdeps.m4 2008-12-06 16:16:00.000000000 -0500
+@@ -158,6 +160,9 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
+ if test -n "${osreldate}" && test ${osreldate} -ge 600000 ; then
+ EXTRA_SYSDEPS_LIBS="-lgeom -ldevstat"
+ fi
++ AC_CHECK_LIB(util, kinfo_getfile,
++ [EXTRA_SYSDEPS_LIBS="${EXTRA_SYSDEPS_LIBS} -lutil"
++ AC_DEFINE(HAVE_KINFO_GETFILE, 1, [Define if you have the kinfo_getfile function])], [:])
+ ;;
+ esac
+
diff --git a/devel/libgtop/files/patch-src_daemon_server.c b/devel/libgtop/files/patch-src_daemon_server.c
new file mode 100644
index 000000000..bf0bba5c7
--- /dev/null
+++ b/devel/libgtop/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/libgtop/files/patch-sysdeps_freebsd_Makefile.am b/devel/libgtop/files/patch-sysdeps_freebsd_Makefile.am
new file mode 100644
index 000000000..25ec1f7d7
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_Makefile.am
@@ -0,0 +1,17 @@
+--- sysdeps/freebsd/Makefile.am.orig 2008-09-29 17:21:56.000000000 -0400
++++ sysdeps/freebsd/Makefile.am 2008-09-29 17:22:07.000000000 -0400
+@@ -7,12 +7,12 @@ libgtop_sysdeps_2_0_la_SOURCES = nosuid.
+ cpu.c msg_limits.c sem_limits.c loadavg.c \
+ uptime.c netlist.c fsusage.c mem.c \
+ mountlist.c procopenfiles.c procwd.c \
+- procaffinity.c glibtop_private.c
++ procaffinity.c glibtop_private.c open.c
+
+ libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
+
+ libgtop_sysdeps_suid_2_0_la_LIBADD = $(KVM_LIBS) $(EXTRA_SYSDEPS_LIBS)
+-libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c swap.c \
++libgtop_sysdeps_suid_2_0_la_SOURCES = suid_open.c close.c swap.c \
+ proclist.c procstate.c procuid.c \
+ proctime.c procmem.c procsignal.c \
+ prockernel.c procsegment.c procargs.c \
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_Makefile.in b/devel/libgtop/files/patch-sysdeps_freebsd_Makefile.in
new file mode 100644
index 000000000..d60fe782e
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_Makefile.in
@@ -0,0 +1,43 @@
+--- sysdeps/freebsd/Makefile.in.orig 2009-01-13 01:49:02.172092000 -0500
++++ sysdeps/freebsd/Makefile.in 2009-01-13 01:53:30.000000000 -0500
+@@ -50,7 +50,8 @@ libgtop_sysdeps_2_0_la_LIBADD =
+ am_libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo sysinfo.lo \
+ shm_limits.lo cpu.lo msg_limits.lo sem_limits.lo loadavg.lo \
+ uptime.lo netlist.lo fsusage.lo mem.lo mountlist.lo \
+- procopenfiles.lo procwd.lo procaffinity.lo glibtop_private.lo
++ procopenfiles.lo procwd.lo procaffinity.lo glibtop_private.lo \
++ open.lo
+ libgtop_sysdeps_2_0_la_OBJECTS = $(am_libgtop_sysdeps_2_0_la_OBJECTS)
+ libgtop_sysdeps_2_0_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+@@ -58,7 +59,7 @@ libgtop_sysdeps_2_0_la_LINK = $(LIBTOOL)
+ am__DEPENDENCIES_1 =
+ libgtop_sysdeps_suid_2_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+-am_libgtop_sysdeps_suid_2_0_la_OBJECTS = open.lo close.lo swap.lo \
++am_libgtop_sysdeps_suid_2_0_la_OBJECTS = suid_open.lo close.lo swap.lo \
+ proclist.lo procstate.lo procuid.lo proctime.lo procmem.lo \
+ procsignal.lo prockernel.lo procsegment.lo procargs.lo \
+ procmap.lo netload.lo ppp.lo
+@@ -296,11 +297,11 @@ libgtop_sysdeps_2_0_la_SOURCES = nosuid.
+ cpu.c msg_limits.c sem_limits.c loadavg.c \
+ uptime.c netlist.c fsusage.c mem.c \
+ mountlist.c procopenfiles.c procwd.c \
+- procaffinity.c glibtop_private.c
++ procaffinity.c glibtop_private.c open.c
+
+ libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
+ libgtop_sysdeps_suid_2_0_la_LIBADD = $(KVM_LIBS) $(EXTRA_SYSDEPS_LIBS)
+-libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c swap.c \
++libgtop_sysdeps_suid_2_0_la_SOURCES = suid_open.c close.c swap.c \
+ proclist.c procstate.c procuid.c \
+ proctime.c procmem.c procsignal.c \
+ prockernel.c procsegment.c procargs.c \
+@@ -375,6 +376,7 @@ distclean-compile:
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlist.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netload.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nosuid.Plo@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/suid_open.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppp.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procaffinity.Plo@am__quote@
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_nosuid.c b/devel/libgtop/files/patch-sysdeps_freebsd_nosuid.c
new file mode 100644
index 000000000..acb327f98
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_nosuid.c
@@ -0,0 +1,19 @@
+--- sysdeps/freebsd/nosuid.c.orig 2008-09-29 17:28:31.000000000 -0400
++++ sysdeps/freebsd/nosuid.c 2008-09-29 17:28:39.000000000 -0400
+@@ -21,16 +21,8 @@
+
+ #include <config.h>
+ #include <glibtop.h>
+-#include <glibtop/open.h>
+ #include <glibtop/close.h>
+
+ void
+-glibtop_open_s (glibtop *server,
+- const char *program_name,
+- const unsigned long features,
+- const unsigned flags)
+-{ }
+-
+-void
+ glibtop_close_s (glibtop *server)
+ { }
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_open.c b/devel/libgtop/files/patch-sysdeps_freebsd_open.c
new file mode 100644
index 000000000..f7bf0e3b1
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_open.c
@@ -0,0 +1,91 @@
+--- sysdeps/freebsd/open.c.orig 2008-05-23 18:13:23.000000000 -0400
++++ sysdeps/freebsd/open.c 2008-09-29 17:23:22.000000000 -0400
+@@ -20,76 +20,33 @@
+ */
+
+ #include <config.h>
++#include <sys/types.h>
++#include <sys/sysctl.h>
+ #include <glibtop.h>
+-#include <glibtop/error.h>
+ #include <glibtop/open.h>
+-#include <glibtop/init_hooks.h>
+-
+-/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
+-
+-void
+-glibtop_init_p (glibtop *server, const unsigned long features,
+- const unsigned flags)
+-{
+- const _glibtop_init_func_t *init_fkt;
+-
+- if (server == NULL)
+- glibtop_error_r (NULL, "glibtop_init_p (server == NULL)");
+-
+- /* Do the initialization, but only if not already initialized. */
+-
+- if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
+- glibtop_open_p (server, "glibtop", features, flags);
++#include <glibtop/cpu.h>
++#include <glibtop/error.h>
+
+- for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
+- (*init_fkt) (server);
++#include <glibtop_private.h>
+
+- server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
+- }
+-}
+
+ void
+-glibtop_open_p (glibtop *server, const char *program_name,
++glibtop_open_s (glibtop *server, const char *program_name,
+ const unsigned long features,
+ const unsigned flags)
+ {
+-#ifdef DEBUG
+- fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ());
+-#endif
++ int ncpus;
++ size_t len;
+
+- /* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
++ len = sizeof (ncpus);
++ sysctlbyname ("hw.ncpu", &ncpus, &len, NULL, 0);
++ server->real_ncpu = ncpus - 1;
++ server->ncpu = MIN(GLIBTOP_NCPU - 1, server->real_ncpu);
+
+- server->machine.uid = getuid ();
+- server->machine.euid = geteuid ();
+- server->machine.gid = getgid ();
+- server->machine.egid = getegid ();
+ #if defined(__FreeBSD_kernel__)
+ server->os_version_code = __FreeBSD_kernel_version;
+ #else
+ server->os_version_code = __FreeBSD_version;
+ #endif
+- /* Setup machine-specific data */
+- server->machine.kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "kvm_open");
+-
+- if (server->machine.kd == NULL)
+- glibtop_error_io_r (server, "kvm_open");
+-
+- /* Drop priviledges. */
+-
+- if (setreuid (server->machine.euid, server->machine.uid))
+- _exit (1);
+-
+- if (setregid (server->machine.egid, server->machine.gid))
+- _exit (1);
+-
+- /* !!! END OF SUID ROOT PART !!! */
+-
+- /* Our effective uid is now those of the user invoking the server,
+- * so we do no longer have any priviledges. */
+
+- /* NOTE: On FreeBSD, we do not need to be suid root, we just need to
+- * be sgid kmem.
+- *
+- * The server will only use setegid() to get back it's priviledges,
+- * so it will fail if it is suid root and not sgid kmem. */
+ }
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_procopenfiles.c b/devel/libgtop/files/patch-sysdeps_freebsd_procopenfiles.c
new file mode 100644
index 000000000..e14dd39bd
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_procopenfiles.c
@@ -0,0 +1,59 @@
+--- sysdeps/freebsd/procopenfiles.c.orig 2008-08-18 11:23:36.000000000 -0400
++++ sysdeps/freebsd/procopenfiles.c 2008-12-07 00:17:26.000000000 -0500
+@@ -35,6 +35,9 @@
+ #include <sys/user.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#ifdef HAVE_KINFO_PROC
++#include <libutil.h>
++#endif
+ #include <string.h>
+ #include <stdlib.h>
+
+@@ -263,8 +266,12 @@ glibtop_get_proc_open_files_s (glibtop *
+ {
+ #if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
+ struct kinfo_file *freep, *kif;
++#ifndef HAVE_KINFO_GETFILE
+ int name[4];
+ size_t len;
++#else
++ int cnt;
++#endif
+ size_t i;
+ #else
+ char *output;
+@@ -274,6 +281,7 @@ glibtop_get_proc_open_files_s (glibtop *
+ memset(buf, 0, sizeof (glibtop_proc_open_files));
+
+ #if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
++#ifndef HAVE_KINFO_GETFILE
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_FILEDESC;
+@@ -287,12 +295,25 @@ glibtop_get_proc_open_files_s (glibtop *
+ g_free(freep);
+ return NULL;
+ }
++#else
++ freep = kinfo_getfile(pid, &cnt);
++#endif
+
+ entries = g_array_new(FALSE, FALSE, sizeof(glibtop_open_files_entry));
+
++#ifndef HAVE_KINFO_GETFILE
+ for (i = 0; i < len / sizeof(*kif); i++, kif++) {
+ glibtop_open_files_entry entry = {0};
+
++ if (kif->kf_structsize != sizeof(*kif))
++ continue;
++#else
++ for (i = 0; i < cnt; i++) {
++ glibtop_open_files_entry entry = {0};
++
++ kif = &freep[i];
++#endif
++
+ if (kif->kf_fd < 0)
+ continue;
+
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_procwd.c b/devel/libgtop/files/patch-sysdeps_freebsd_procwd.c
new file mode 100644
index 000000000..731fec120
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_procwd.c
@@ -0,0 +1,58 @@
+--- sysdeps/freebsd/procwd.c.orig 2008-08-18 11:23:36.000000000 -0400
++++ sysdeps/freebsd/procwd.c 2008-12-07 00:19:44.000000000 -0500
+@@ -27,6 +27,9 @@
+ #include <sys/sysctl.h>
+ #include <sys/param.h>
+ #include <sys/user.h>
++#ifdef HAVE_KINFO_GETFILE
++#include <libutil.h>
++#endif
+ #include <string.h>
+
+ static const unsigned long _glibtop_sysdeps_proc_wd =
+@@ -101,10 +104,14 @@ glibtop_get_proc_wd_s(glibtop *server, g
+ #if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
+ struct kinfo_file *freep, *kif;
+ GPtrArray *dirs;
++#ifndef HAVE_KINFO_GETFILE
+ size_t len;
+- int i;
+ int name[4];
+ #else
++ int cnt;
++#endif
++ int i;
++#else
+ char *output;
+ #endif
+
+@@ -115,6 +122,7 @@ glibtop_get_proc_wd_s(glibtop *server, g
+ buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
+
+ #if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
++#ifndef HAVE_KINFO_GETFILE
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_FILEDESC;
+@@ -127,10 +135,21 @@ glibtop_get_proc_wd_s(glibtop *server, g
+ g_free(freep);
+ return NULL;
+ }
++#else
++ freep = kinfo_getfile(pid, &cnt);
++#endif
+
+ dirs = g_ptr_array_sized_new(1);
+
++#ifndef HAVE_KINFO_GETFILE
+ for (i = 0; i < len / sizeof(*kif); i++, kif++) {
++ if (kif->kf_structsize != sizeof(*kif))
++ continue;
++#else
++ for (i = 0; i < cnt; i++) {
++ kif = &freep[i];
++#endif
++
+ switch (kif->kf_fd) {
+ case KF_FD_TYPE_ROOT:
+ g_strlcpy(buf->root, kif->kf_path,
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_suid_open.c b/devel/libgtop/files/patch-sysdeps_freebsd_suid_open.c
new file mode 100644
index 000000000..a188b364c
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_suid_open.c
@@ -0,0 +1,94 @@
+--- sysdeps/freebsd/suid_open.c.orig 2008-09-29 17:22:12.000000000 -0400
++++ sysdeps/freebsd/suid_open.c 2008-09-29 17:23:35.000000000 -0400
+@@ -0,0 +1,91 @@
++/* Copyright (C) 1998 Joshua Sled
++ This file is part of LibGTop 1.0.
++
++ Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
++
++ LibGTop is free software; you can redistribute it and/or modify it
++ under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License,
++ or (at your option) any later version.
++
++ LibGTop is distributed in the hope that it will be useful, but WITHOUT
++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++ for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with LibGTop; see the file COPYING. If not, write to the
++ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA.
++*/
++
++#include <config.h>
++#include <glibtop.h>
++#include <glibtop/error.h>
++#include <glibtop/cpu.h>
++#include <glibtop/open.h>
++#include <glibtop/init_hooks.h>
++
++
++/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
++
++void
++glibtop_init_p (glibtop *server, const unsigned long features,
++ const unsigned flags)
++{
++ const _glibtop_init_func_t *init_fkt;
++
++ if (server == NULL)
++ glibtop_error_r (NULL, "glibtop_init_p (server == NULL)");
++
++ /* Do the initialization, but only if not already initialized. */
++
++ if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
++ glibtop_open_p (server, "glibtop", features, flags);
++
++ for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
++ (*init_fkt) (server);
++
++ server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
++ }
++}
++
++void
++glibtop_open_p (glibtop *server, const char *program_name,
++ const unsigned long features,
++ const unsigned flags)
++{
++#ifdef DEBUG
++ fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ());
++#endif
++
++ /* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
++ server->machine.uid = getuid ();
++ server->machine.euid = geteuid ();
++ server->machine.gid = getgid ();
++ server->machine.egid = getegid ();
++ /* Setup machine-specific data */
++ server->machine.kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "kvm_open");
++
++ if (server->machine.kd == NULL)
++ glibtop_error_io_r (server, "kvm_open");
++
++ /* Drop priviledges. */
++
++ if (setreuid (server->machine.euid, server->machine.uid))
++ _exit (1);
++
++ if (setregid (server->machine.egid, server->machine.gid))
++ _exit (1);
++
++ /* !!! END OF SUID ROOT PART !!! */
++
++ /* Our effective uid is now those of the user invoking the server,
++ * so we do no longer have any priviledges. */
++
++ /* NOTE: On FreeBSD, we do not need to be suid root, we just need to
++ * be sgid kmem.
++ *
++ * The server will only use setegid() to get back it's priviledges,
++ * so it will fail if it is suid root and not sgid kmem. */
++}
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_sysinfo.c b/devel/libgtop/files/patch-sysdeps_freebsd_sysinfo.c
new file mode 100644
index 000000000..ab5fdd66d
--- /dev/null
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_sysinfo.c
@@ -0,0 +1,13 @@
+--- sysdeps/freebsd/sysinfo.c.orig 2008-05-23 18:13:23.000000000 -0400
++++ sysdeps/freebsd/sysinfo.c 2008-09-29 14:35:25.000000000 -0400
+@@ -45,8 +45,8 @@ init_sysinfo (glibtop *server)
+
+ glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
+
+- len = sizeof (ncpus);
+- sysctlbyname ("hw.ncpu", &ncpus, &len, NULL, 0);
++ ncpus = server->ncpu + 1;
++
+ len = 0;
+ sysctlbyname ("hw.model", NULL, &len, NULL, 0);
+ model = g_malloc (len);
diff --git a/devel/libgtop/files/pkg-message b/devel/libgtop/files/pkg-message
new file mode 100644
index 000000000..dacaf62a9
--- /dev/null
+++ b/devel/libgtop/files/pkg-message
@@ -0,0 +1,13 @@
+===============================================================================
+
+In order to use the File System read/write monitor, you must chmod
+/dev/devstat so that all users can open it read-only. For example:
+
+# chmod 0444 /dev/devstat
+
+In order for this to persist across reboots, add the following to
+/etc/devfs.conf:
+
+perm devstat 0444
+
+===============================================================================
diff --git a/devel/libgtop/pkg-descr b/devel/libgtop/pkg-descr
new file mode 100644
index 000000000..f263f1127
--- /dev/null
+++ b/devel/libgtop/pkg-descr
@@ -0,0 +1,3 @@
+This library provides the backend for gtop2, a GNOME 2.0 version
+of top(1) that allows display and manipulation of running
+processes.
diff --git a/devel/libgtop/pkg-plist b/devel/libgtop/pkg-plist
new file mode 100644
index 000000000..cbba908c8
--- /dev/null
+++ b/devel/libgtop/pkg-plist
@@ -0,0 +1,205 @@
+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/fsusage.h
+include/libgtop-2.0/glibtop/global.h
+include/libgtop-2.0/glibtop/gnuserv.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/netlist.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/procaffinity.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/procopenfiles.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/procwd.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/union.h
+include/libgtop-2.0/glibtop/uptime.h
+include/libgtop-2.0/glibtop/version.h
+include/libgtop-2.0/glibtop_machine.h
+include/libgtop-2.0/glibtop_private.h
+include/libgtop-2.0/glibtop_server.h
+include/libgtop-2.0/glibtop_suid.h
+include/libgtop-2.0/libgtopconfig.h
+lib/libgtop-2.0.a
+lib/libgtop-2.0.la
+lib/libgtop-2.0.so
+lib/libgtop-2.0.so.7
+libdata/pkgconfig/libgtop-2.0.pc
+%%DOCSDIR%%/home.png
+%%DOCSDIR%%/index.html
+%%DOCSDIR%%/index.sgml
+%%DOCSDIR%%/left.png
+%%DOCSDIR%%/libgtop-Close.html
+%%DOCSDIR%%/libgtop-Command.html
+%%DOCSDIR%%/libgtop-GlibTop-Server.html
+%%DOCSDIR%%/libgtop-GlibTop.html
+%%DOCSDIR%%/libgtop-Net-List.html
+%%DOCSDIR%%/libgtop-Net-Load.html
+%%DOCSDIR%%/libgtop-PPP.html
+%%DOCSDIR%%/libgtop-Shared-Memory-Limits.html
+%%DOCSDIR%%/libgtop-Uptime.html
+%%DOCSDIR%%/libgtop-cpu.html
+%%DOCSDIR%%/libgtop-fsusage.html
+%%DOCSDIR%%/libgtop-lib.html
+%%DOCSDIR%%/libgtop-loadavg.html
+%%DOCSDIR%%/libgtop-mem.html
+%%DOCSDIR%%/libgtop-mountlist.html
+%%DOCSDIR%%/libgtop-msg-limits.html
+%%DOCSDIR%%/libgtop-open.html
+%%DOCSDIR%%/libgtop-parameter.html
+%%DOCSDIR%%/libgtop-procargs.html
+%%DOCSDIR%%/libgtop-prockernel.html
+%%DOCSDIR%%/libgtop-proclist.html
+%%DOCSDIR%%/libgtop-procmap.html
+%%DOCSDIR%%/libgtop-procmem.html
+%%DOCSDIR%%/libgtop-procopenfiles.html
+%%DOCSDIR%%/libgtop-procsegment.html
+%%DOCSDIR%%/libgtop-procsignal.html
+%%DOCSDIR%%/libgtop-procstate.html
+%%DOCSDIR%%/libgtop-proctime.html
+%%DOCSDIR%%/libgtop-procuid.html
+%%DOCSDIR%%/libgtop-sem-limits.html
+%%DOCSDIR%%/libgtop-signal.html
+%%DOCSDIR%%/libgtop-swap.html
+%%DOCSDIR%%/libgtop-sysdeps.html
+%%DOCSDIR%%/libgtop-sysinfo.html
+%%DOCSDIR%%/libgtop-union.html
+%%DOCSDIR%%/libgtop-version.html
+%%DOCSDIR%%/libgtop-white-paper-overview.html
+%%DOCSDIR%%/libgtop-white-paper.html
+%%DOCSDIR%%/libgtop.devhelp
+%%DOCSDIR%%/libgtop.devhelp2
+%%DOCSDIR%%/right.png
+%%DOCSDIR%%/style.css
+%%DOCSDIR%%/up.png
+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/bn_IN/LC_MESSAGES/libgtop-2.0.mo
+share/locale/bs/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/dz/LC_MESSAGES/libgtop-2.0.mo
+share/locale/el/LC_MESSAGES/libgtop-2.0.mo
+share/locale/en_CA/LC_MESSAGES/libgtop-2.0.mo
+share/locale/en_GB/LC_MESSAGES/libgtop-2.0.mo
+share/locale/eo/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/eu/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/gu/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/hr/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/ka/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ko/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ku/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ky/LC_MESSAGES/libgtop-2.0.mo
+share/locale/la/LC_MESSAGES/libgtop-2.0.mo
+share/locale/lt/LC_MESSAGES/libgtop-2.0.mo
+share/locale/lv/LC_MESSAGES/libgtop-2.0.mo
+share/locale/mg/LC_MESSAGES/libgtop-2.0.mo
+share/locale/mi/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/mr/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ms/LC_MESSAGES/libgtop-2.0.mo
+share/locale/nb/LC_MESSAGES/libgtop-2.0.mo
+share/locale/ne/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/oc/LC_MESSAGES/libgtop-2.0.mo
+share/locale/or/LC_MESSAGES/libgtop-2.0.mo
+share/locale/pa/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/rw/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@latin/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/te/LC_MESSAGES/libgtop-2.0.mo
+share/locale/th/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/xh/LC_MESSAGES/libgtop-2.0.mo
+share/locale/zh_CN/LC_MESSAGES/libgtop-2.0.mo
+share/locale/zh_HK/LC_MESSAGES/libgtop-2.0.mo
+share/locale/zh_TW/LC_MESSAGES/libgtop-2.0.mo
+@dirrm %%DOCSDIR%%
+@dirrm include/libgtop-2.0/glibtop
+@dirrm include/libgtop-2.0
+@dirrmtry share/locale/zh_HK/LC_MESSAGES
+@dirrmtry share/locale/zh_HK
+@dirrmtry share/locale/xh/LC_MESSAGES
+@dirrmtry share/locale/xh
+@dirrmtry share/locale/te/LC_MESSAGES
+@dirrmtry share/locale/te
+@dirrmtry share/locale/sr@latin/LC_MESSAGES
+@dirrmtry share/locale/sr@latin
+@dirrmtry share/locale/rw/LC_MESSAGES
+@dirrmtry share/locale/rw
+@dirrmtry share/locale/oc/LC_MESSAGES
+@dirrmtry share/locale/oc
+@dirrmtry share/locale/mr/LC_MESSAGES
+@dirrmtry share/locale/mr
+@dirrmtry share/locale/mi/LC_MESSAGES
+@dirrmtry share/locale/mi
+@dirrmtry share/locale/mg/LC_MESSAGES
+@dirrmtry share/locale/mg
+@dirrmtry share/locale/la/LC_MESSAGES
+@dirrmtry share/locale/la
+@dirrmtry share/locale/ky/LC_MESSAGES
+@dirrmtry share/locale/ky
+@dirrmtry share/locale/ku/LC_MESSAGES
+@dirrmtry share/locale/ku
+@dirrmtry share/locale/dz/LC_MESSAGES
+@dirrmtry share/locale/dz
+@dirrmtry share/locale/bn_IN/LC_MESSAGES
+@dirrmtry share/locale/bn_IN