update to 2.20.0

This switches to the new gnome-2.20 branch.

pkgsrc notes:
-System dependant parts were reorganized upstream, in particular there
 if a subtree for FreeBSD now, and one for the other BSDs. I didn't
 pull in the DragonFly patches because I can't decide whether to base
 them on the freebsd or the rest.
-I've changed the NetBSD code to use kinfo_proc2 almost completely.
 Some vm statistics reporting might be less accurate now because
 some fields in proc2 seem to be unmaintained by the current kernel
 (eg ixrss).
-Also, some libgtop functions might be able to run in the non-privileged
 part now, but dealing with this would require even more #ifdefs, so
 we should consider setting up a private subtree as FreeBSD did.
-I didn't verify with older NetBSDs; kvm_getproc2() has been in the
 tree for quite some time so I hope it will just work without the need
 for excessive "#if __NetBSD_Version__ > t".
This commit is contained in:
drochner 2007-11-05 19:06:02 +00:00
parent b0c37064d8
commit 4d7f1acf90
26 changed files with 626 additions and 1036 deletions

View file

@ -1,9 +1,8 @@
# $NetBSD: Makefile,v 1.12 2007/09/21 13:04:19 wiz Exp $
# $NetBSD: Makefile,v 1.13 2007/11/05 19:06:02 drochner Exp $
DISTNAME= libgtop-2.14.2
PKGREVISION= 6
DISTNAME= libgtop-2.20.0
CATEGORIES= sysutils gnome
MASTER_SITES= ${MASTER_SITE_GNOME:=sources/libgtop/2.14/}
MASTER_SITES= ${MASTER_SITE_GNOME:=sources/libgtop/2.20/}
EXTRACT_SUFX= .tar.bz2
MAINTAINER= pkgsrc-users@NetBSD.org
@ -41,6 +40,9 @@ PRINT_PLIST_AWK+= /^include\/libgtop-2.0\/glibtop_suid.h$$/ \
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == NetBSD
CONFIGURE_ENV+= fu_cv_sys_mounted_getmntinfo=yes
. if (${MACHINE_ARCH} != alpha) && \
(${MACHINE_ARCH} != arm) && (${MACHINE_ARCH} != arm32) && \
(${MACHINE_ARCH} != i386) && (${MACHINE_ARCH} != m68k) && \

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.4 2007/09/20 21:12:05 wiz Exp $
@comment $NetBSD: PLIST,v 1.5 2007/11/05 19:06:02 drochner Exp $
${LIBGTOP_SERVER}bin/libgtop_daemon2
${LIBGTOP_SERVER}bin/libgtop_server2
include/libgtop-2.0/glibtop.h
@ -8,7 +8,6 @@ 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/inodedb.h
include/libgtop-2.0/glibtop/loadavg.h
include/libgtop-2.0/glibtop/mem.h
include/libgtop-2.0/glibtop/mountlist.h
@ -29,6 +28,7 @@ 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
@ -45,6 +45,53 @@ include/libgtop-2.0/libgtopconfig.h
info/libgtop2.info
lib/libgtop-2.0.la
lib/pkgconfig/libgtop-2.0.pc
share/gtk-doc/html/libgtop/home.png
share/gtk-doc/html/libgtop/index.html
share/gtk-doc/html/libgtop/index.sgml
share/gtk-doc/html/libgtop/left.png
share/gtk-doc/html/libgtop/libgtop-Close.html
share/gtk-doc/html/libgtop/libgtop-Command.html
share/gtk-doc/html/libgtop/libgtop-GlibTop-Server.html
share/gtk-doc/html/libgtop/libgtop-GlibTop.html
share/gtk-doc/html/libgtop/libgtop-Net-List.html
share/gtk-doc/html/libgtop/libgtop-Net-Load.html
share/gtk-doc/html/libgtop/libgtop-PPP.html
share/gtk-doc/html/libgtop/libgtop-Shared-Memory-Limits.html
share/gtk-doc/html/libgtop/libgtop-Uptime.html
share/gtk-doc/html/libgtop/libgtop-cpu.html
share/gtk-doc/html/libgtop/libgtop-fsusage.html
share/gtk-doc/html/libgtop/libgtop-lib.html
share/gtk-doc/html/libgtop/libgtop-loadavg.html
share/gtk-doc/html/libgtop/libgtop-mem.html
share/gtk-doc/html/libgtop/libgtop-mountlist.html
share/gtk-doc/html/libgtop/libgtop-msg-limits.html
share/gtk-doc/html/libgtop/libgtop-open.html
share/gtk-doc/html/libgtop/libgtop-parameter.html
share/gtk-doc/html/libgtop/libgtop-procargs.html
share/gtk-doc/html/libgtop/libgtop-prockernel.html
share/gtk-doc/html/libgtop/libgtop-proclist.html
share/gtk-doc/html/libgtop/libgtop-procmap.html
share/gtk-doc/html/libgtop/libgtop-procmem.html
share/gtk-doc/html/libgtop/libgtop-procopenfiles.html
share/gtk-doc/html/libgtop/libgtop-procsegment.html
share/gtk-doc/html/libgtop/libgtop-procsignal.html
share/gtk-doc/html/libgtop/libgtop-procstate.html
share/gtk-doc/html/libgtop/libgtop-proctime.html
share/gtk-doc/html/libgtop/libgtop-procuid.html
share/gtk-doc/html/libgtop/libgtop-sem-limits.html
share/gtk-doc/html/libgtop/libgtop-signal.html
share/gtk-doc/html/libgtop/libgtop-swap.html
share/gtk-doc/html/libgtop/libgtop-sysdeps.html
share/gtk-doc/html/libgtop/libgtop-sysinfo.html
share/gtk-doc/html/libgtop/libgtop-union.html
share/gtk-doc/html/libgtop/libgtop-version.html
share/gtk-doc/html/libgtop/libgtop-white-paper-overview.html
share/gtk-doc/html/libgtop/libgtop-white-paper.html
share/gtk-doc/html/libgtop/libgtop.devhelp
share/gtk-doc/html/libgtop/libgtop.devhelp2
share/gtk-doc/html/libgtop/right.png
share/gtk-doc/html/libgtop/style.css
share/gtk-doc/html/libgtop/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
@ -58,6 +105,7 @@ 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
@ -94,6 +142,7 @@ 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
@ -109,6 +158,7 @@ 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/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
@ -117,5 +167,6 @@ 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 share/gtk-doc/html/libgtop
@dirrm include/libgtop-2.0/glibtop
@dirrm include/libgtop-2.0

View file

@ -1,27 +1,21 @@
$NetBSD: distinfo,v 1.4 2007/09/20 21:12:06 wiz Exp $
$NetBSD: distinfo,v 1.5 2007/11/05 19:06:03 drochner Exp $
SHA1 (libgtop-2.14.2.tar.bz2) = 20e79a58c08e06e5f5e68d8ebbd575471f754e96
RMD160 (libgtop-2.14.2.tar.bz2) = cb51f7252e015e17dcf3f1f991b36bf3e5496efe
Size (libgtop-2.14.2.tar.bz2) = 664817 bytes
SHA1 (patch-aa) = 01f43f6786e1d2727b68acb0083283e33cbc9ae5
SHA1 (patch-ab) = 3a00a1c4f0d895d0e2ecc2bceabc4bbc5dbaa422
SHA1 (patch-ac) = c645307376eddb5c469ab00bd7ec8217feb3e2d5
SHA1 (patch-ad) = ada3c0128c0b7d3b670f8d30c910fe4c1e2e351a
SHA1 (patch-ae) = 035419a4e8a505c672f727c843dbd977acd8ce35
SHA1 (patch-af) = 520dbdec4a8cba6e82b08c169d97c3caebacd419
SHA1 (patch-ag) = 2329761a8f0278e8f04a5704b4ab2f63d6b24576
SHA1 (patch-ah) = 57d112d551149190a6b9c24074427457f8591691
SHA1 (patch-ai) = 57d891785a45ec532757a48e77adafec091f3953
SHA1 (patch-aj) = c244b5c60e61594c3d2c0bc95e05e12ad68938db
SHA1 (patch-ak) = b8365370cd25da8626fc636d4c9faf91a626067d
SHA1 (patch-al) = 5f7fb52914005c089c72589e8883bc062d3f14ab
SHA1 (patch-am) = 42bfab5f3e65734e98cee0c4035b17dc515514cf
SHA1 (patch-an) = 57a79bddc3f0e8237b72486aa8f8906f318ca38d
SHA1 (patch-ao) = 456feb151050332f1bc6577363329da175499dbc
SHA1 (patch-ap) = 1b842a59b821b2703b68935f59a65ffb6db3a68f
SHA1 (libgtop-2.20.0.tar.bz2) = 0b7b7ad57c5b9e8d2fcd3e3f70bf61ba85fbb962
RMD160 (libgtop-2.20.0.tar.bz2) = 3f03f505995f5bd8b44319c9cf4ba5c4440c4180
Size (libgtop-2.20.0.tar.bz2) = 766106 bytes
SHA1 (patch-ab) = cd11ad54870ab54fb940f922c1cc55d1c7ec2161
SHA1 (patch-ac) = 3dd59355e36657df4c8575c35ef11c28d4192d77
SHA1 (patch-ag) = 8ed7b66b4250dbc6f6321cef24941f58106fcbaf
SHA1 (patch-ai) = 856c457b14e384b2c991bf51274f97a3a9c853f1
SHA1 (patch-aj) = 94e41923f13732118e8e809a09ec4162bf2ca422
SHA1 (patch-al) = 8d69828a73fd8f87cef08786bc5c3cd864210da6
SHA1 (patch-am) = e69e9fd4ea90d2bb467050b5b4e8490baa162ef7
SHA1 (patch-an) = 169366e6dc034db05eb54d6abb1416889f17a8e2
SHA1 (patch-ao) = f58a1bd19d63377b86478e72f23bd5a4cca5af76
SHA1 (patch-aq) = bb44484df341a009aa269fbaf5039e351e105e6c
SHA1 (patch-ba) = fc99c68ec9765439bc82a38223a74bde319d26d5
SHA1 (patch-bb) = 2940eeb9468f34683bd6d8adca196b669c412bfd
SHA1 (patch-bc) = 3638dfee30a4f10bc9662c23063df3f6a8cdc914
SHA1 (patch-bd) = 7825fd4d2e6c06510fa3d76b4efa4d2ffab2a7d8
SHA1 (patch-bg) = f4adb1f60c777a92e63f4ad0fef6d9addea5f856
SHA1 (patch-ca) = e92c33e38ef522c179ec4508b239e4eb84a83c9c
SHA1 (patch-cb) = f95adc119389b75fd4d1954a2f6ef8ff0431bf91
SHA1 (patch-cc) = 2cb1d2da57a8622c93ed255a416ed9c811e775a2
SHA1 (patch-cd) = cf96896ddde9c830c1e808d8bf37b9fdb611ed24

View file

@ -1,241 +0,0 @@
$NetBSD: patch-aa,v 1.5 2007/09/20 21:12:06 wiz Exp $
--- configure.orig 2006-07-27 18:43:37.000000000 +0000
+++ configure
@@ -20112,17 +20112,17 @@ echo $ECHO_N "checking for libgtop sysde
libgtop_have_sysinfo=yes
libgtop_need_server=no
;;
- freebsd*|netbsd*|openbsd*|bsdi*)
+ freebsd*|netbsd*|openbsd*|bsdi*|dragonfly*)
libgtop_sysdeps_dir=freebsd
libgtop_use_machine_h=yes
libgtop_need_server=yes
- libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
+ libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server'
;;
solaris*)
libgtop_sysdeps_dir=solaris
libgtop_use_machine_h=yes
libgtop_need_server=yes
- libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
+ libgtop_postinstall='chgrp sys $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server'
;;
aix*)
libgtop_sysdeps_dir=aix
@@ -20170,7 +20170,7 @@ echo "${ECHO_T}$libgtop_sysdeps_dir" >&6
case "$host_os" in
- *bsd*)
+ *bsd* | *dragonfly*)
echo "$as_me:$LINENO: checking for kvm_open in -lkvm" >&5
echo $ECHO_N "checking for kvm_open in -lkvm... $ECHO_C" >&6
if test "${ac_cv_lib_kvm_kvm_open+set}" = set; then
@@ -20413,7 +20413,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#include <net/netisr.h>
#include <net/route.h>
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__DragonFly__)
+#include <net/sppp/if_sppp.h>
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
#include <net/if_sppp.h>
#else
#include <i4b/sppp/if_sppp.h>
@@ -20488,7 +20490,9 @@ cat >>conftest.$ac_ext <<_ACEOF
#include <net/netisr.h>
#include <net/route.h>
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__DragonFly__)
+#include <net/sppp/if_sppp.h>
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
#include <net/if_sppp.h>
#else
#include <i4b/sppp/if_sppp.h>
@@ -20561,9 +20565,10 @@ echo $ECHO_N "checking what we need to d
echo $ECHO_N "(cached) $ECHO_C" >&6
else
msginfo_needs=
- for def in nothing KERNEL _KERNEL; do
+ for def in nothing KERNEL _KERNEL_STRUCTURES _KERNEL; do
cat >conftest.$ac_ext <<_ACEOF
#define $def
+#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <stdio.h>
@@ -23925,6 +23930,146 @@ fi
esac
+echo "$as_me:$LINENO: checking for kvm_open in -lkvm" >&5
+echo $ECHO_N "checking for kvm_open in -lkvm... $ECHO_C" >&6
+if test "${ac_cv_lib_mach_kvm_open+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkvm $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 gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char kvm_open ();
+int
+main ()
+{
+kvm_open ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_mach_kvm_open=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_mach_kvm_open=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_mach_kvm_open" >&5
+echo "${ECHO_T}$ac_cv_lib_mach_kvm_open" >&6
+if test $ac_cv_lib_mach_kvm_open = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMACH 1
+_ACEOF
+
+ KVM_LIBS="-lkvm $KVM_LIBS"
+
+fi
+
+echo "$as_me:$LINENO: checking for kinfo_get_sched_hz in -lkinfo" >&5
+echo $ECHO_N "checking for kinfo_get_sched_hz in -lkinfo... $ECHO_C" >&6
+if test "${ac_cv_lib_kinfo_kinfo_get_sched_gz+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkinfo $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 gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char kinfo_get_sched_hz ();
+int
+main ()
+{
+kinfo_get_sched_hz ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_kinfo_kinfo_get_sched_hz=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_kinfo_kinfo_get_sched_hz=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_kinfo_kinfo_get_sched_hz" >&5
+echo "${ECHO_T}$ac_cv_lib_kinfo_kinfo_get_sched_hz" >&6
+if test $ac_cv_lib_kinfo_kinfo_get_sched_hz = yes; then
+
+ LIBS="-lkinfo $LIBS" # we need kvm as well
+fi
+
echo "$as_me:$LINENO: checking for vm_statistics in -lmach" >&5
echo $ECHO_N "checking for vm_statistics in -lmach... $ECHO_C" >&6
if test "${ac_cv_lib_mach_vm_statistics+set}" = set; then
@@ -29952,7 +30097,7 @@ if test x$cross_compiling = xyes ; then
sunos*)
fu_cv_sys_stat_statfs4=yes
;;
- freebsd*)
+ freebsd* | dragonfly*)
fu_cv_sys_stat_statfs2_bsize=yes
;;
osf*)
@@ -30603,7 +30748,7 @@ cat >>conftest.$ac_ext <<_ACEOF
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "f_type;" >/dev/null 2>&1; then
+ $EGREP "f_type;|struct statvfs" >/dev/null 2>&1; then
ok=yes
fi
rm -f conftest*
@@ -32141,6 +32290,7 @@ s,@ECHO_C@,$ECHO_C,;t t
s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t
+s,@KVM_LIBS@,$KVM_LIBS,;t t
s,@build@,$build,;t t
s,@build_cpu@,$build_cpu,;t t
s,@build_vendor@,$build_vendor,;t t

View file

@ -1,94 +1,105 @@
$NetBSD: patch-ab,v 1.6 2007/09/20 21:12:06 wiz Exp $
$NetBSD: patch-ab,v 1.7 2007/11/05 19:06:03 drochner Exp $
--- sysdeps/freebsd/proctime.c.orig 2006-04-04 20:01:43.000000000 +0000
+++ sysdeps/freebsd/proctime.c
@@ -32,6 +32,10 @@
#include <osreldate.h>
#endif
--- sysdeps/bsd/proctime.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/proctime.c
@@ -40,11 +40,25 @@ static const unsigned long _glibtop_sysd
+#ifdef __NetBSD__
+#include <sys/resourcevar.h>
#define tv2sec(tv) (((guint64) tv.tv_sec * 1000000) + (guint64) tv.tv_usec)
+#if defined(__NetBSD__)
+static unsigned int clockrate;
+static const int mib [] = { CTL_KERN, KERN_CLOCKRATE };
+#endif
+
static const unsigned long _glibtop_sysdeps_proc_time =
(1L << GLIBTOP_PROC_TIME_RTIME) + (1L << GLIBTOP_PROC_TIME_FREQUENCY);
/* Init function. */
@@ -58,7 +62,7 @@ glibtop_init_proc_time_p (glibtop *serve
void
_glibtop_init_proc_time_p (glibtop *server)
{
+#if defined(__NetBSD__)
+ struct clockinfo ci;
+ size_t length;
+ length = sizeof (ci);
+ if (sysctl (mib, 2, &ci, &length, NULL, 0) == 0)
+ clockrate = ci.hz;
+ if (!clockrate)
+ clockrate = 1; /* XXX avoid div by 0 later */
+#endif
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time |
_glibtop_sysdeps_proc_time_user;
}
@@ -56,7 +70,7 @@ _glibtop_init_proc_time_p (glibtop *serv
* system, and interrupt time usage.
*/
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
-#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
+#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__))
#ifndef __FreeBSD__
static void
@@ -125,7 +129,9 @@ glibtop_get_proc_time_p (glibtop *server
calcru(p, up, sp, ip)
@@ -114,13 +128,17 @@ void
glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
pid_t pid)
{
+#if defined (__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
-#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || (defined(OpenBSD) && (OpenBSD >= 199912))
+#if (defined(OpenBSD) && (OpenBSD >= 199912))
register struct rusage *rup;
#else
struct user *u_addr = (struct user *)USRSTACK;
#endif
+#if !defined(__DragonFly__)
struct pstats pstats;
+#endif
+#endif /* NetBSD */
int count;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0);
@@ -142,11 +148,15 @@ glibtop_get_proc_time_p (glibtop *server
@@ -136,7 +154,12 @@ glibtop_get_proc_time_p (glibtop *server
#endif
/* Get the process information */
+#if defined (__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof (*pinfo), &count);
+#else
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 >= 500013)
+#endif
if ((pinfo == NULL) || (count != 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -146,14 +169,31 @@ glibtop_get_proc_time_p (glibtop *server
buf->rtime = pinfo [0].ki_runtime;
+#elif defined(__DragonFly__)
+ buf->rtime = pinfo [0].kp_eproc.e_uticks / 100000;
#elif (defined __FreeBSD__) && (__FreeBSD_version <= 500013)
buf->rtime = pinfo [0].kp_proc.p_runtime;
+#elif defined (__NetBSD__)
+ buf->rtime = pinfo[0].p_rtime_sec * clockrate
+ + pinfo[0].p_rtime_usec * clockrate / 1000000;
+ buf->frequency = clockrate;
#else
@@ -189,16 +199,38 @@ glibtop_get_proc_time_p (glibtop *server
if ((pinfo [0].ki_flag & P_INMEM)) {
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
+ buf->frequency = 1000000;
#endif
buf->utime = pinfo [0].ki_runtime;
- buf->stime = 0; /* XXX */
+ buf->stime = tv2sec (pinfo [0].ki_rusage.ru_stime);
buf->cutime = tv2sec (pinfo [0].ki_childtime);
- buf->cstime = 0; /* XXX */
+#if __FreeBSD_version >= 600000
+ buf->cstime = tv2sec (pinfo [0].ki_rusage_ch.ru_stime);
+#else
+ buf->cstime = 0;
+#endif
buf->start_time = tv2sec (pinfo [0].ki_start);
buf->flags = _glibtop_sysdeps_proc_time_user;
}
- buf->frequency = 1000000;
buf->flags = _glibtop_sysdeps_proc_time;
-#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) || (defined(OpenBSD) && (OpenBSD >= 199912))
+#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
+
+ buf->utime = pinfo[0].p_uutime_sec * 1000000
+ + pinfo[0].p_uutime_usec;
+ buf->stime = pinfo[0].p_ustime_sec * 1000000
+ + pinfo[0].p_ustime_usec;
+ buf->cutime = pinfo[0].p_uctime_sec * 1000000
+ + pinfo[0].p_uctime_usec; /* XXX is u+s */
+ buf->cstime = 0; /* XXX */
+ buf->start_time = pinfo[0].p_ustart_sec;
+
+ buf->flags |= _glibtop_sysdeps_proc_time_user;
+
+#elif (defined(OpenBSD) && (OpenBSD >= 199912))
glibtop_suid_enter (server);
-#elif (__FreeBSD_version <= 500013)
+#elif defined(__DragonFly__)
+
+ if ((pinfo [0].kp_proc.p_flag & P_SWAPPEDOUT) == 0)
+ {
+
+ buf->utime = pinfo[0].kp_eproc.e_uticks / 1000000;
+ buf->stime = pinfo[0].kp_eproc.e_sticks / 1000000;
+#if __DragonFly_version >= 180000
+ buf->cutime = 0; /* XXX no idea about this */
+ buf->cstime = 0;
+#else
+ 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);
+#endif
+ buf->start_time = tv2sec (pinfo[0].kp_thread.td_start);
+ buf->flags = _glibtop_sysdeps_proc_time_user;
+ glibtop_suid_leave (server);
+ }
+#elif defined(__FreeBSD__) && (__FreeBSD_version <= 500013)
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc,
if (kvm_read (server->machine.kd,

View file

@ -1,6 +1,6 @@
$NetBSD: patch-ac,v 1.5 2007/09/20 21:12:07 wiz Exp $
$NetBSD: patch-ac,v 1.6 2007/11/05 19:06:03 drochner Exp $
--- sysdeps/common/mountlist.c.orig 2003-10-20 09:29:03.000000000 -0500
--- sysdeps/common/mountlist.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/common/mountlist.c
@@ -106,7 +106,7 @@ static struct mount_entry *read_filesyst
#endif
@ -32,3 +32,11 @@ $NetBSD: patch-ac,v 1.5 2007/09/20 21:12:07 wiz Exp $
me->me_type = g_strdup (fsp->f_fstypename);
#else
me->me_type = g_strdup (fstype_to_string (fsp->f_type));
@@ -544,6 +548,7 @@ static gboolean ignore_mount_entry(const
"devfs",
"devpts",
"fusectl",
+ "kernfs",
"linprocfs",
"mfs",
"mntfs",

View file

@ -1,19 +0,0 @@
$NetBSD: patch-ad,v 1.5 2007/09/20 21:12:07 wiz Exp $
--- sysdeps/freebsd/fsusage.c.orig 2006-04-09 18:52:45.000000000 +0200
+++ sysdeps/freebsd/fsusage.c
@@ -47,8 +47,12 @@ _glibtop_freebsd_get_fsusage_read_write(
return;
}
+#ifdef HAVE_STATVFS_READS_COUNT
buf->read = sfs.f_syncreads + sfs.f_asyncreads;
+ buf->flags |= (1 << GLIBTOP_FSUSAGE_READ);
+#endif
+#ifdef HAVE_STATVFS_WRITES_COUNT
buf->write = sfs.f_syncwrites + sfs.f_asyncwrites;
-
- buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
+ buf->flags |= (1 << GLIBTOP_FSUSAGE_WRITE);
+#endif
}

View file

@ -1,87 +0,0 @@
$NetBSD: patch-ae,v 1.5 2007/09/20 21:12:08 wiz Exp $
--- sysdeps/freebsd/cpu.c.orig 2005-07-08 19:49:56.000000000 +0000
+++ sysdeps/freebsd/cpu.c
@@ -27,16 +27,73 @@
#include <glibtop_suid.h>
-#ifdef __NetBSD__
-#include <sys/sched.h>
-#endif
-
static const unsigned long _glibtop_sysdeps_cpu =
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY) +
(1L << GLIBTOP_CPU_IOWAIT);
+#if defined(__DragonFly__)
+#include <kinfo.h>
+
+/* Init function. */
+
+void
+glibtop_init_cpu_p (glibtop *server)
+{
+ server->sysdeps.cpu = _glibtop_sysdeps_cpu;
+}
+
+/* Provides information about cpu usage. */
+void
+glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
+{
+ struct kinfo_cputime cp_time;
+ int hz;
+
+ glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0);
+
+ memset (buf, 0, sizeof (glibtop_cpu));
+
+ /* If this fails, the module was not setuped. */
+ if (server->sysdeps.cpu == 0)
+ return;
+
+ if (kinfo_get_sched_cputime(&cp_time)) {
+ glibtop_warn_io_r (server, "kinfo_get_sched_cputime");
+ return;
+ }
+ if (kinfo_get_sched_hz(&hz)) {
+ glibtop_warn_io_r (server, "kinfo_get_sched hz");
+ return;
+ }
+ /* set user time */
+ buf->user = cp_time.cp_user;
+ /* set nice time */
+ buf->nice = cp_time.cp_nice;
+ /* set sys time */
+ buf->sys = cp_time.cp_sys;
+ /* set idle time */
+ buf->idle = cp_time.cp_idle;
+ /* set iowait (really just interrupt) time */
+ buf->iowait = cp_time.cp_idle;
+
+ /* set frequency */
+ buf->frequency = hz;
+ /* set total */
+ buf->total = cp_time.cp_user + cp_time.cp_sys + cp_time.cp_nice +
+ cp_time.cp_idle;
+
+ /* Set the flags last. */
+ buf->flags = _glibtop_sysdeps_cpu;
+}
+
+#else
+
+#ifdef __NetBSD__
+#include <sys/sched.h>
+#endif
+
#ifndef KERN_CP_TIME
/* nlist structure for kernel access */
static struct nlist nlst [] = {
@@ -141,3 +198,4 @@ glibtop_get_cpu_p (glibtop *server, glib
/* Set the flags last. */
buf->flags = _glibtop_sysdeps_cpu;
}
+#endif

View file

@ -1,14 +0,0 @@
$NetBSD: patch-af,v 1.5 2007/09/20 21:12:08 wiz Exp $
--- sysdeps/freebsd/glibtop_machine.h.orig 2005-07-08 19:00:00.000000000 +0000
+++ sysdeps/freebsd/glibtop_machine.h
@@ -27,7 +27,9 @@
#include <sys/param.h>
#include <nlist.h>
#include <kvm.h>
+#ifndef __DragonFly__
#include <sys/dkstat.h>
+#endif
#include <time.h>
#include <sys/user.h>
#include <sys/types.h>

View file

@ -1,35 +1,8 @@
$NetBSD: patch-ag,v 1.5 2007/09/20 21:12:08 wiz Exp $
$NetBSD: patch-ag,v 1.6 2007/11/05 19:06:04 drochner Exp $
--- sysdeps/freebsd/mem.c.orig 2005-12-12 11:09:39.000000000 +0100
+++ sysdeps/freebsd/mem.c
@@ -28,6 +28,10 @@
#include <glibtop_suid.h>
+#if defined(__DragonFly__)
+#include <kinfo.h>
+#endif
+
#include <sys/sysctl.h>
#include <sys/vmmeter.h>
#if defined(__NetBSD__) && (__NetBSD_Version__ < 105020000)
@@ -58,6 +62,7 @@ static int pageshift; /* log base 2 of
/* define pagetok in terms of pageshift */
#define pagetok(size) ((size) << pageshift)
+#if !defined(__DragonFly__)
/* nlist structure for kernel access */
static struct nlist nlst [] = {
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
@@ -75,6 +80,7 @@ static struct nlist nlst [] = {
{ 0 }
#endif
};
+#endif
/* MIB array for sysctl */
#ifdef __bsdi__
@@ -83,7 +89,9 @@ static int mib [] = { CTL_VM, VM_TOTAL }
--- sysdeps/bsd/mem.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/mem.c
@@ -81,7 +81,9 @@ static int mib [] = { CTL_VM, VM_TOTAL }
static int mib [] = { CTL_VM, VM_METER };
#endif
@ -40,20 +13,7 @@ $NetBSD: patch-ag,v 1.5 2007/09/20 21:12:08 wiz Exp $
static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
#endif
@@ -94,10 +102,12 @@ glibtop_init_mem_p (glibtop *server)
{
register int pagesize;
+#if !defined(__DragonFly__)
if (kvm_nlist (server->machine.kd, nlst) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (mem)");
return;
}
+#endif
/* get the page size with "getpagesize" and calculate pageshift
* from it */
@@ -119,9 +129,15 @@ glibtop_get_mem_p (glibtop *server, glib
@@ -117,7 +119,10 @@ glibtop_get_mem_p (glibtop *server, glib
{
struct vmtotal vmt;
size_t length_vmt;
@ -61,99 +21,7 @@ $NetBSD: patch-ag,v 1.5 2007/09/20 21:12:08 wiz Exp $
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+ struct uvmexp_sysctl uvmexp;
+ size_t length_uvmexp;
+#elif defined(__OpenBSD__)
+#elif defined(__OpenBSD__)
struct uvmexp uvmexp;
size_t length_uvmexp;
+#elif defined(__DragonFly__)
+ struct vmstats vms;
+ size_t vms_size;
#else
struct vmmeter vmm;
#endif
@@ -142,11 +158,19 @@ glibtop_get_mem_p (glibtop *server, glib
* here.] */
/* Get the data from sysctl */
+#if defined(__DragonFly__)
+ length_vmt = sizeof (vmt);
+ if (sysctlbyname ("vm.vmtotal", &vmt, &length_vmt, NULL, 0)) {
+ glibtop_warn_io_r (server, "sysctl (vmt)");
+ return;
+ }
+#else
length_vmt = sizeof (vmt);
if (sysctl (mib, 2, &vmt, &length_vmt, NULL, 0)) {
glibtop_warn_io_r (server, "sysctl (vmt)");
return;
}
+#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
length_uvmexp = sizeof (uvmexp);
@@ -154,6 +178,12 @@ glibtop_get_mem_p (glibtop *server, glib
glibtop_warn_io_r (server, "sysctl (uvmexp)");
return;
}
+#elif defined(__DragonFly__)
+ vms_size = sizeof(vms);
+ if (sysctlbyname("vm.vmstats", &vms, &vms_size, NULL, 0)) {
+ glibtop_warn_io_r (server, "kvm_read (vms)");
+ return;
+ }
#else
/* Get the data from kvm_* */
if (kvm_read (server->machine.kd, nlst[1].n_value,
@@ -163,15 +193,24 @@ glibtop_get_mem_p (glibtop *server, glib
}
#endif
+#if defined(__DragonFly__)
+ if (kinfo_get_vfs_bufspace(&bufspace)) {
+ glibtop_warn_io_r (server, "kinfo_get_vfs_bufspace");
+ return;
+ }
+#else
if (kvm_read (server->machine.kd, nlst[0].n_value,
&bufspace, sizeof (bufspace)) != sizeof (bufspace)) {
glibtop_warn_io_r (server, "kvm_read (bufspace)");
return;
}
+#endif
/* convert memory stats to Kbytes */
-#if defined(__FreeBSD__)
+#if defined(__DragonFly__)
+ v_total_count = vms.v_page_count;
+#elif defined(__FreeBSD__)
v_total_count = vmm.v_page_count;
#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
@@ -189,6 +228,9 @@ glibtop_get_mem_p (glibtop *server, glib
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
v_used_count = uvmexp.active + uvmexp.inactive;
v_free_count = uvmexp.free;
+#elif defined(__DragonFly__)
+ v_used_count = vms.v_active_count + vms.v_inactive_count;
+ v_free_count = vms.v_free_count;
#else
v_used_count = vmm.v_active_count + vmm.v_inactive_count;
v_free_count = vmm.v_free_count;
@@ -198,12 +240,16 @@ glibtop_get_mem_p (glibtop *server, glib
buf->used = (guint64) pagetok (v_used_count) << LOG1024;
buf->free = (guint64) pagetok (v_free_count) << LOG1024;
-#ifdef __FreeBSD__
+#if defined(__DragonFly__)
+ buf->cached = (guint64) pagetok (vms.v_cache_count) << LOG1024;
+#elif defined(__FreeBSD__)
buf->cached = (guint64) pagetok (vmm.v_cache_count) << LOG1024;
#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) || defined(__OpenBSD__)
buf->locked = (guint64) pagetok (uvmexp.wired) << LOG1024;
+#elif defined(__DragonFly__)
+ buf->locked = (guint64) pagetok (vms.v_wire_count) << LOG1024;
#else
buf->locked = (guint64) pagetok (vmm.v_wire_count) << LOG1024;
#endif

View file

@ -1,12 +0,0 @@
$NetBSD: patch-ah,v 1.3 2007/09/20 21:12:09 wiz Exp $
--- sysdeps/freebsd/open.c.orig 2005-12-12 11:09:39.000000000 +0100
+++ sysdeps/freebsd/open.c
@@ -23,6 +23,7 @@
#include <config.h>
#include <glibtop.h>
+#include <glibtop/error.h>
#include <glibtop/open.h>
#include <glibtop/init_hooks.h>

View file

@ -1,46 +1,119 @@
$NetBSD: patch-ai,v 1.3 2007/09/20 21:12:09 wiz Exp $
$NetBSD: patch-ai,v 1.4 2007/11/05 19:06:04 drochner Exp $
--- sysdeps/freebsd/prockernel.c.orig 2004-09-24 22:49:06.000000000 +0000
+++ sysdeps/freebsd/prockernel.c
@@ -35,7 +35,7 @@
#include <sys/user.h>
#endif
#if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__)) && \
- !defined(__NetBSD__)
+ !defined(__NetBSD__) && !defined(__DragonFly__)
#include <machine/pcb.h>
--- sysdeps/bsd/prockernel.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/prockernel.c
@@ -45,6 +45,7 @@
#include <osreldate.h>
#endif
@@ -93,7 +93,7 @@ glibtop_get_proc_kernel_p (glibtop *serv
+#if 0
#ifdef __NetBSD__
#include <machine/vmparam.h>
#include <machine/pmap.h>
@@ -60,17 +61,22 @@
#define KERNBASE KERNEL_BASE
#endif
#endif
-
+#endif /* 0 */
static const unsigned long _glibtop_sysdeps_proc_kernel_pstats =
(1L << GLIBTOP_PROC_KERNEL_MIN_FLT) +
-(1L << GLIBTOP_PROC_KERNEL_MAJ_FLT) +
-(1L << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
-(1L << GLIBTOP_PROC_KERNEL_CMAJ_FLT);
+(1L << GLIBTOP_PROC_KERNEL_MAJ_FLT)
+#if !defined(__NetBSD__)
++ (1L << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
+(1L << GLIBTOP_PROC_KERNEL_CMAJ_FLT)
+#endif
+;
+#if !defined(__NetBSD__)
static const unsigned long _glibtop_sysdeps_proc_kernel_pcb =
(1L << GLIBTOP_PROC_KERNEL_KSTK_EIP) +
(1L << GLIBTOP_PROC_KERNEL_KSTK_ESP);
+#endif
static const unsigned long _glibtop_sysdeps_proc_kernel_wchan =
(1L << GLIBTOP_PROC_KERNEL_NWCHAN) +
@@ -82,7 +88,9 @@ void
_glibtop_init_proc_kernel_p (glibtop *server)
{
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel_pstats |
+#if !defined(__NetBSD__)
_glibtop_sysdeps_proc_kernel_pcb |
+#endif
_glibtop_sysdeps_proc_kernel_wchan;
}
@@ -91,12 +99,16 @@ glibtop_get_proc_kernel_p (glibtop *serv
glibtop_proc_kernel *buf,
pid_t pid)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
struct user *u_addr = (struct user *)USRSTACK;
struct pstats pstats;
struct pcb pcb;
@@ -126,9 +126,14 @@ glibtop_get_proc_kernel_p (glibtop *serv
#endif
+#endif /* NetBSD */
int count;
char filename [BUFSIZ];
@@ -113,7 +125,12 @@ glibtop_get_proc_kernel_p (glibtop *serv
if (pid == 0) return;
/* Get the process information */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof(*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count != 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -125,6 +142,10 @@ glibtop_get_proc_kernel_p (glibtop *serv
#define PROC_WMESG ki_wmesg
#define PROC_WMESG ki_wmesg
+#elif defined(__NetBSD__)
+
+/* nothing for now */
+
#else
+#ifdef __DragonFly__
+#define PROC_WCHAN kp_thread.td_wchan
+#define PROC_WMESG kp_thread.td_wmesg
+#else
#define PROC_WCHAN kp_proc.p_wchan
#define PROC_WMESG kp_proc.p_wmesg
#define PROC_WMESG kp_eproc.e_wmesg
+#endif
@@ -133,6 +154,21 @@ glibtop_get_proc_kernel_p (glibtop *serv
#endif
@@ -146,7 +151,7 @@ glibtop_get_proc_kernel_p (glibtop *serv
}
#endif
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
/* Taken from `saveuser ()' in `/usr/src/bin/ps/ps.c'. */
+#if defined(__NetBSD__)
+
+ buf->nwchan = pinfo[0].p_wchan;
+ if (pinfo[0].p_wchan && pinfo[0].p_wmesg)
+ g_strlcpy(buf->wchan, pinfo[0].p_wmesg,
+ sizeof buf->wchan);
+
+ buf->min_flt = pinfo[0].p_uru_minflt;
+ buf->maj_flt = pinfo[0].p_uru_majflt;
+
+ buf->flags |= (_glibtop_sysdeps_proc_kernel_wchan
+ | _glibtop_sysdeps_proc_kernel_pstats);
+
+#else
+
#if !defined(__NetBSD__) || !defined(SACTIVE)
buf->nwchan = (unsigned long) pinfo [0].PROC_WCHAN &~ KERNBASE;
@@ -267,4 +303,6 @@ glibtop_get_proc_kernel_p (glibtop *serv
*/
return;
#endif /* __FreeBSD__ */
+
+#endif /* NetBSD */
}

View file

@ -1,16 +1,47 @@
$NetBSD: patch-aj,v 1.3 2007/09/20 21:12:09 wiz Exp $
$NetBSD: patch-aj,v 1.4 2007/11/05 19:06:04 drochner Exp $
--- sysdeps/freebsd/proclist.c.orig 2004-09-23 22:44:19.000000000 +0000
+++ sysdeps/freebsd/proclist.c
@@ -92,7 +92,11 @@ glibtop_get_proclist_p (glibtop *server,
--- sysdeps/bsd/proclist.c.orig 2007-05-19 20:59:37.000000000 +0200
+++ sysdeps/bsd/proclist.c
@@ -56,11 +56,15 @@ _glibtop_init_proclist_p (glibtop *serve
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
}
-unsigned *
+pid_t *
glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
gint64 real_which, gint64 arg)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
unsigned *pids = NULL;
int which, count;
int i,j;
@@ -72,7 +76,12 @@ glibtop_get_proclist_p (glibtop *server,
which = (int)(real_which & GLIBTOP_KERN_PROC_MASK);
/* Get the process data */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, which, arg,
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, which, arg, &count);
+#endif
if ((pinfo == NULL) || (count < 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (proclist)");
return NULL;
@@ -89,6 +98,12 @@ glibtop_get_proclist_p (glibtop *server,
#define PROC_RUID ki_ruid
#define PROC_PID ki_pid
+#elif defined(__NetBSD__)
+
+#define PROC_STAT p_stat
+#define PROC_RUID p_ruid
+#define PROC_PID p_pid
+
#else
#define PROC_STAT kp_proc.p_stat
+#ifdef __DragonFly__
+#define PROC_RUID kp_eproc.e_ucred.cr_ruid
+#else
#define PROC_RUID kp_eproc.e_pcred.p_ruid
+#endif
#define PROC_PID kp_proc.p_pid
#endif

View file

@ -1,70 +0,0 @@
$NetBSD: patch-ak,v 1.3 2007/09/20 21:12:10 wiz Exp $
--- sysdeps/freebsd/procmap.c.orig 2005-12-12 10:09:39.000000000 +0000
+++ sysdeps/freebsd/procmap.c
@@ -21,6 +21,10 @@
Boston, MA 02111-1307, USA.
*/
+#ifdef __DragonFly__
+#define _KERNEL_STRUCTURES
+#endif
+
#include <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
@@ -41,7 +45,7 @@
#else
#include <vm/vm_object.h>
#include <vm/vm_map.h>
-#if (__FreeBSD_version >= 400011)
+#if defined(__DragonFly__) || (defined(__FreeBSD__) && __FreeBSD_version >= 400011)
#include <vm/vm.h>
#else
#include <vm/vm_prot.h>
@@ -109,9 +113,9 @@ glibtop_get_proc_map_p (glibtop *server,
struct vm_object object;
#endif
glibtop_map_entry *maps;
-#if defined __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
struct vnode vnode;
-#if __FreeBSD_version < 500039
+#if (defined(__FreeBSD__) && __FreeBSD_version < 500039) || defined(__DragonFly__)
struct inode inode;
#endif
#endif
@@ -130,7 +134,7 @@ glibtop_get_proc_map_p (glibtop *server,
/* 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);
+ glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return NULL;
}
@@ -178,9 +182,12 @@ glibtop_get_proc_map_p (glibtop *server,
} else {
update = 1;
}
-
-#ifdef __FreeBSD__
-#if __FreeBSD__ >= 4
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__DragonFly__) && __DragonFly_version >= 180000
+ if (entry.eflags != VM_MAPTYPE_NORMAL &&
+ entry.eflags != VM_MAPTYPE_VPAGETABLE)
+ continue;
+#elif (defined(__FreeBSD__) && __FreeBSD__ >= 4) || defined(__DragonFly__)
if (entry.eflags & (MAP_ENTRY_IS_SUB_MAP))
continue;
#else
@@ -256,7 +263,7 @@ glibtop_get_proc_map_p (glibtop *server,
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
/* If the object is of type vnode, add its size */
if (object.type != OBJT_VNODE)

View file

@ -1,39 +1,69 @@
$NetBSD: patch-al,v 1.5 2007/09/20 21:12:10 wiz Exp $
$NetBSD: patch-al,v 1.6 2007/11/05 19:06:05 drochner Exp $
--- sysdeps/freebsd/procmem.c.orig 2005-12-12 10:09:39.000000000 +0000
+++ sysdeps/freebsd/procmem.c
@@ -41,7 +41,9 @@
#include <sys/vnode.h>
#include <ufs/ufs/quota.h>
+#if !defined(__DragonFly__)
#include <ufs/ufs/inode.h>
+#endif
#include <sys/ucred.h>
#if (!defined __OpenBSD__) && (!defined __bsdi__)
@@ -63,6 +65,10 @@
#include <uvm/uvm.h>
--- sysdeps/bsd/procmem.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procmem.c
@@ -116,6 +116,9 @@ void
glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
pid_t pid)
{
+#if defined (__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
struct vm_map_entry entry, *first;
struct vmspace *vms, vmspace;
@@ -127,6 +130,7 @@ glibtop_get_proc_mem_p (glibtop *server,
#if (!defined(__FreeBSD__) || (__FreeBSD_version < 500013)) && !defined(__FreeBSD_kernel__)
struct plimit plimit;
#endif
+#endif /* NetBSD */
int count;
+#ifdef __NetBSD__
+#include <sys/resourcevar.h>
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0);
@@ -140,7 +144,12 @@ glibtop_get_proc_mem_p (glibtop *server,
if (pid == 0) return;
/* Get the process data */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
+
static const unsigned long _glibtop_sysdeps_proc_mem =
(1L << GLIBTOP_PROC_MEM_SIZE) +
(1L << GLIBTOP_PROC_MEM_VSIZE) +
@@ -214,8 +220,11 @@ glibtop_get_proc_mem_p (glibtop *server,
return;
}
if ((pinfo == NULL) || (count < 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -157,6 +166,15 @@ glibtop_get_proc_mem_p (glibtop *server,
buf->resident = buf->rss = (guint64) pagetok
(pinfo [0].ki_rssize) << LOG1024;
-#ifdef __FreeBSD__
-#if __FreeBSD__ >= 4
+#if defined(__DragonFly__) && (__DragonFly_version >= 180000)
+ if (entry.maptype != VM_MAPTYPE_NORMAL && entry.maptype != VM_MAPTYPE_VPAGETABLE)
+ continue;
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__DragonFly__) || (defined(__FreeBSD__) && __FreeBSD__ >= 4)
if (entry.eflags & (MAP_ENTRY_IS_SUB_MAP))
continue;
+#elif defined(__NetBSD__)
+
+ buf->rss_rlim = pinfo[0].p_uru_maxrss;
+ buf->vsize = buf->size = (guint64)pagetok
+ (pinfo[0].p_vm_tsize + pinfo[0].p_vm_dsize + pinfo[0].p_vm_ssize)
+ << LOG1024;
+ buf->resident = buf->rss = (guint64)pagetok
+ (pinfo[0].p_vm_rssize) << LOG1024;
+
#else
#define PROC_VMSPACE kp_proc.p_vmspace
@@ -182,6 +200,9 @@ glibtop_get_proc_mem_p (glibtop *server,
/* Now we get the shared memory. */
+#if defined(__NetBSD__)
+ buf->share = pinfo[0].p_uru_ixrss;
+#else
if (kvm_read (server->machine.kd,
(unsigned long) pinfo [0].PROC_VMSPACE,
(char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) {
@@ -287,6 +308,7 @@ glibtop_get_proc_mem_p (glibtop *server,
buf->share += object.un_pager.vnp.vnp_size;
#endif
}
+#endif /* NetBSD */
buf->flags = _glibtop_sysdeps_proc_mem |
_glibtop_sysdeps_proc_mem_share;

View file

@ -1,12 +1,12 @@
$NetBSD: patch-am,v 1.4 2007/09/20 21:12:11 wiz Exp $
$NetBSD: patch-am,v 1.5 2007/11/05 19:06:05 drochner Exp $
--- sysdeps/freebsd/procsignal.c.orig 2005-12-12 10:09:39.000000000 +0000
+++ sysdeps/freebsd/procsignal.c
@@ -53,7 +53,11 @@ glibtop_get_proc_signal_p (glibtop *serv
--- sysdeps/bsd/procsignal.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procsignal.c
@@ -51,7 +51,11 @@ glibtop_get_proc_signal_p (glibtop *serv
glibtop_proc_signal *buf,
pid_t pid)
{
+#if defined(KERN_PROC2)
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
@ -14,98 +14,90 @@ $NetBSD: patch-am,v 1.4 2007/09/20 21:12:11 wiz Exp $
int count = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
@@ -64,7 +68,12 @@ glibtop_get_proc_signal_p (glibtop *serv
@@ -62,7 +66,12 @@ glibtop_get_proc_signal_p (glibtop *serv
if (pid == 0) return;
/* Get the process information */
+#if defined(KERN_PROC2)
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof(struct kinfo_proc2), &count);
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count != 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -77,6 +86,13 @@ glibtop_get_proc_signal_p (glibtop *serv
@@ -75,6 +84,10 @@ glibtop_get_proc_signal_p (glibtop *serv
#define PROC_SIGIGNORE ki_sigignore
#define PROC_SIGCATCH ki_sigcatch
+#elif defined(KERN_PROC2)
+#elif defined(__NetBSD__)
+
+#define PROC_SIGLIST p_siglist
+#define PROC_SIGMASK p_sigmask
+#define PROC_SIGIGNORE p_sigignore
+#define PROC_SIGCATCH p_sigcatch
+/* nothing for now */
+
#else
#define PROC_SIGLIST kp_proc.p_siglist
@@ -89,11 +105,12 @@ glibtop_get_proc_signal_p (glibtop *serv
@@ -87,6 +100,9 @@ glibtop_get_proc_signal_p (glibtop *serv
/* signal: mask of pending signals.
* pinfo [0].kp_proc.p_siglist
*/
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
- buf->signal [0] = pinfo [0].kp_proc.p_sigctx.ps_siglist.__bits[0];
-#elif (defined(__NetBSD__) && (NSIG > 32)) || \
- (defined(__FreeBSD__) && (__FreeBSD_version >= 400011))
+#if (defined(__NetBSD__) && (NSIG > 32)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) || \
+ defined(__DragonFly__)
buf->signal [0] = pinfo [0].PROC_SIGLIST.__bits[0];
+#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
+ buf->signal [0] = pinfo [0].kp_proc.p_sigctx.ps_siglist.__bits[0];
+#if defined(__NetBSD__)
+ buf->signal[0] = pinfo[0].p_siglist.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->signal [0] = pinfo [0].kp_proc.p_sigctx.ps_siglist.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -95,10 +111,14 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->signal [0] = pinfo [0].kp_proc.p_siglist;
#endif
@@ -101,11 +118,12 @@ glibtop_get_proc_signal_p (glibtop *serv
+#endif /* NetBSD */
/* blocked: mask of blocked signals.
* pinfo [0].kp_proc.p_sigmask
*/
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
- buf->blocked [0] = pinfo [0].kp_proc.p_sigctx.ps_sigmask.__bits[0];
-#elif (defined(__NetBSD__) && (NSIG > 32)) || \
- (defined(__FreeBSD__) && (__FreeBSD_version >= 400011))
+#if (defined(__NetBSD__) && (NSIG > 32)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) || \
+ defined(__DragonFly__)
buf->blocked [0] = pinfo [0].PROC_SIGMASK.__bits[0];
+#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
+ buf->blocked [0] = pinfo [0].kp_proc.p_sigctx.ps_sigmask.__bits[0];
+#if defined(__NetBSD__)
+ buf->blocked[0] = pinfo[0].p_sigmask.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->blocked [0] = pinfo [0].kp_proc.p_sigctx.ps_sigmask.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -107,10 +127,14 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->blocked [0] = pinfo [0].kp_proc.p_sigmask;
#endif
@@ -113,11 +131,12 @@ glibtop_get_proc_signal_p (glibtop *serv
+#endif /* NetBSD */
/* sigignore: mask of ignored signals.
* pinfo [0].kp_proc.p_sigignore
*/
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
- buf->sigignore [0] = pinfo [0].kp_proc.p_sigctx.ps_sigignore.__bits[0];
-#elif (defined(__NetBSD__) && (NSIG > 32)) || \
- (defined(__FreeBSD__) && (__FreeBSD_version >= 400011))
+#if (defined(__NetBSD__) && (NSIG > 32)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) || \
+ defined(__DragonFly__)
buf->sigignore [0] = pinfo [0].PROC_SIGIGNORE.__bits[0];
+#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
+ buf->sigignore [0] = pinfo [0].kp_proc.p_sigctx.ps_sigignore.__bits[0];
+#if defined(__NetBSD__)
+ buf->sigignore[0] = pinfo[0].p_sigignore.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->sigignore [0] = pinfo [0].kp_proc.p_sigctx.ps_sigignore.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -119,10 +143,14 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore;
#endif
@@ -125,11 +144,12 @@ glibtop_get_proc_signal_p (glibtop *serv
+#endif /* NetBSD */
/* sigcatch: mask of caught signals.
* pinfo [0].kp_proc.p_sigcatch
*/
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
- buf->sigcatch [0] = pinfo [0].kp_proc.p_sigctx.ps_sigcatch.__bits[0];
-#elif (defined(__NetBSD__) && (NSIG > 32)) || \
- (defined(__FreeBSD__) && (__FreeBSD_version >= 400011))
+#if (defined(__NetBSD__) && (NSIG > 32)) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 400011)) || \
+ defined(__DragonFly__)
buf->sigcatch [0] = pinfo [0].PROC_SIGCATCH.__bits[0];
+#elif defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
+ buf->sigcatch [0] = pinfo [0].kp_proc.p_sigctx.ps_sigcatch.__bits[0];
+#if defined(__NetBSD__)
+ buf->sigcatch[0] = pinfo[0].p_sigcatch.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigctx.ps_sigcatch.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -131,6 +159,7 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch;
#endif
+#endif /* NetBSD */
buf->flags = _glibtop_sysdeps_proc_signal;
}

View file

@ -1,18 +1,42 @@
$NetBSD: patch-an,v 1.3 2007/09/20 21:12:11 wiz Exp $
$NetBSD: patch-an,v 1.4 2007/11/05 19:06:05 drochner Exp $
--- sysdeps/freebsd/procstate.c.orig 2004-09-24 22:49:06.000000000 +0000
+++ sysdeps/freebsd/procstate.c
@@ -80,6 +80,14 @@ glibtop_get_proc_state_p (glibtop *serve
--- sysdeps/bsd/procstate.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procstate.c
@@ -54,7 +54,11 @@ glibtop_get_proc_state_p (glibtop *serve
glibtop_proc_state *buf,
pid_t pid)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
int count = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
@@ -65,7 +69,12 @@ glibtop_get_proc_state_p (glibtop *serve
if (pid == 0) return;
/* Get the process information */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count != 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -79,6 +88,13 @@ glibtop_get_proc_state_p (glibtop *serve
#define PROC_RGID ki_rgid
#define PROC_STAT ki_stat
+#elif defined(__DragonFly__)
+#define PROC_COMM kp_thread.td_comm
+#define PROC_SVUID kp_eproc.e_ucred.cr_svuid
+#define PROC_SVGID kp_eproc.e_ucred.cr_svgid
+#define PROC_RUID kp_eproc.e_ucred.cr_ruid
+#define PROC_RGID kp_eproc.e_ucred.cr_rgid
+#define PROC_STAT kp_proc.p_stat
+#elif defined(__NetBSD__)
+
+#define PROC_COMM p_comm
+#define PROC_SVUID p_svuid
+#define PROC_SVGID p_svgid
+#define PROC_STAT p_stat
+
#else
#define PROC_COMM kp_proc.p_comm

View file

@ -1,74 +1,76 @@
$NetBSD: patch-ao,v 1.3 2007/09/20 21:12:11 wiz Exp $
$NetBSD: patch-ao,v 1.4 2007/11/05 19:06:05 drochner Exp $
--- sysdeps/freebsd/procuid.c.orig 2005-12-12 10:09:39.000000000 +0000
+++ sysdeps/freebsd/procuid.c
@@ -53,11 +53,16 @@ void
--- sysdeps/bsd/procuid.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procuid.c
@@ -28,6 +28,7 @@
static const unsigned long _glibtop_sysdeps_proc_uid =
(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) +
+(1L << GLIBTOP_PROC_UID_GID) +
(1L << GLIBTOP_PROC_UID_EGID) + (1L << GLIBTOP_PROC_UID_PID) +
(1L << GLIBTOP_PROC_UID_PPID) + (1L << GLIBTOP_PROC_UID_PGRP) +
(1L << GLIBTOP_PROC_UID_TPGID) + (1L << GLIBTOP_PROC_UID_PRIORITY) +
@@ -51,15 +52,21 @@ void
glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
pid_t pid)
{
+#if defined(KERN_PROC2)
+#if defined (__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
int count = 0;
+#if 0
#if LIBGTOP_VERSION_CODE >= 1001000
-#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
+#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) \
+ && !defined(KERN_PROC2)
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
struct ucred ucred;
void *ucred_ptr;
#endif
@@ -71,7 +76,12 @@ glibtop_get_proc_uid_p (glibtop *server,
#endif
+#endif /* 0 */
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_UID), 0);
@@ -69,7 +76,12 @@ glibtop_get_proc_uid_p (glibtop *server,
if (pid == 0) return;
/* Get the process information */
+#if defined(KERN_PROC2)
+#if defined (__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof(struct kinfo_proc2), &count);
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count != 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -92,8 +102,28 @@ glibtop_get_proc_uid_p (glibtop *server,
#else
#define PROC_PRIORITY ki_priority
#endif
-#else
+#elif defined(__DragonFly__)
+#define PROC_RUID kp_eproc.e_ucred.cr_ruid
+#define PROC_SVUID kp_eproc.e_ucred.cr_svuid
+#define PROC_RGID kp_eproc.e_ucred.cr_rgid
+#define PROC_SVGID kp_eproc.e_ucred.cr_svgid
+#define PROC_PPID kp_eproc.e_ppid
+#define PROC_PGID kp_eproc.e_pgid
+#define PROC_TPGID kp_eproc.e_tpgid
+#define PROC_NICE kp_proc.p_nice
@@ -86,6 +98,20 @@ glibtop_get_proc_uid_p (glibtop *server,
#define PROC_TPGID ki_tpgid
#define PROC_NICE ki_nice
#define PROC_PRIORITY ki_pri.pri_user
+
+#elif defined (__NetBSD__)
+
+#define PROC_RUID p_ruid
+#define PROC_SVUID p_svuid
+#define PROC_RGID p_rgid
+#define PROC_SVGID p_svgid
+#define PROC_PID p_pid
+#define PROC_PPID p_ppid
+#define PROC_PGID p__pgid
+#define PROC_TPGID p_tpgid
+#define PROC_NICE p_nice
+#define PROC_PRIORITY p_priority
+
+#elif defined(KERN_PROC2) /* && defined(__NetBSD__) ? */
+#define PROC_RUID p_ruid
+#define PROC_SVUID p_svuid
+#define PROC_RGID p_rgid
+#define PROC_SVGID p_svgid
+#define PROC_PPID p_ppid
+#define PROC_PGID p__pgid
+#define PROC_TPGID p_tpgid
+#define PROC_NICE p_nice
+#define PROC_PRIORITY p_priority
+#else
#define PROC_RUID kp_eproc.e_pcred.p_ruid
#define PROC_SVUID kp_eproc.e_pcred.p_svuid
#define PROC_RGID kp_eproc.e_pcred.p_rgid
@@ -116,7 +146,7 @@ glibtop_get_proc_uid_p (glibtop *server,
buf->tpgid = pinfo [0].PROC_TPGID;
buf->nice = pinfo [0].PROC_NICE;
-#if defined(__NetBSD__) && defined(SACTIVE)
+#if defined(__DragonFly__) || (defined(__NetBSD__) && defined(SACTIVE))
buf->priority = 0;
#else
buf->priority = pinfo [0].PROC_PRIORITY;
#define PROC_RUID kp_eproc.e_pcred.p_ruid
@@ -105,6 +131,7 @@ glibtop_get_proc_uid_p (glibtop *server,
buf->gid = pinfo [0].PROC_RGID;
buf->egid = pinfo [0].PROC_SVGID;
+ buf->pid = pinfo [0].PROC_PID;
buf->ppid = pinfo [0].PROC_PPID;
buf->pgrp = pinfo [0].PROC_PGID;
buf->tpgid = pinfo [0].PROC_TPGID;

View file

@ -1,69 +0,0 @@
$NetBSD: patch-ap,v 1.3 2007/09/20 21:12:12 wiz Exp $
--- sysdeps/freebsd/swap.c.orig 2004-09-24 22:49:06.000000000 +0000
+++ sysdeps/freebsd/swap.c
@@ -32,7 +32,10 @@ static const unsigned long _glibtop_sysd
(1L << GLIBTOP_SWAP_FREE) + (1L << GLIBTOP_SWAP_PAGEIN) +
(1L << GLIBTOP_SWAP_PAGEOUT);
-#if defined(__FreeBSD__) || defined(__bsdi__)
+#if defined(__DragonFly__)
+#include <sys/vmmeter.h>
+
+#elif defined(__FreeBSD__) || defined(__bsdi__)
#include <sys/conf.h>
#ifdef __bsdi__
@@ -93,8 +96,8 @@ static struct nlist nlst2 [] = {
void
glibtop_init_swap_p (glibtop *server)
{
-#if defined(__FreeBSD__) || defined(__bsdi__)
-#if __FreeBSD__ < 4 || defined(__bsdi__)
+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__bsdi__)
+#if !defined(__DragonFly__) && (__FreeBSD__ < 4 || defined(__bsdi__))
if (kvm_nlist (server->machine.kd, nlst) < 0) {
glibtop_warn_io_r (server, "kvm_nlist (swap)");
return;
@@ -129,9 +132,9 @@ glibtop_init_swap_p (glibtop *server)
void
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
{
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
-# if __FreeBSD__ < 4
+# if defined(__FreeBSD__) && __FreeBSD__ < 4
char *header;
int hlen, nswdev, dmmax;
int div, nfree, npfree;
@@ -193,7 +196,7 @@ glibtop_get_swap_p (glibtop *server, gli
buf->pagein = 0;
buf->pageout = 0;
} else {
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
buf->pagein = vmm.v_swappgsin - swappgsin;
buf->pageout = vmm.v_swappgsout - swappgsout;
#else
@@ -207,7 +210,7 @@ glibtop_get_swap_p (glibtop *server, gli
#endif
}
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
swappgsin = vmm.v_swappgsin;
swappgsout = vmm.v_swappgsout;
#else
@@ -220,9 +223,9 @@ glibtop_get_swap_p (glibtop *server, gli
#endif
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
-#if __FreeBSD__ < 4
+#if defined(__FreeBSD__) && __FreeBSD__ < 4
/* Size of largest swap device. */

View file

@ -1,34 +0,0 @@
$NetBSD: patch-ba,v 1.1 2007/09/20 21:12:13 wiz Exp $
From FreeBSD's GNOME development repository.
--- lib/read.c.orig 2006-04-10 10:41:46.000000000 +0200
+++ lib/read.c
@@ -22,6 +22,7 @@
*/
#include <config.h>
+#include <errno.h>
#include <glibtop/read.h>
#include <glibtop/error.h>
#include <glib/gi18n-lib.h>
@@ -56,14 +57,18 @@ glibtop_read_l (glibtop *server, size_t
fprintf (stderr, "LIBRARY: really reading %d bytes.\n", (int)size);
#endif
+retry:
if (server->socket) {
do_read (server->socket, buf, size);
} else {
- if(read (server->input [0], buf, size) < 0)
+ if(read (server->input [0], buf, size) < 0) {
+ if (errno == EINTR)
+ goto retry;
glibtop_error_io_r (
server,
ngettext ("read %d byte",
"read %d bytes", size),
(int)size);
+ }
}
}

View file

@ -1,35 +0,0 @@
$NetBSD: patch-bb,v 1.1 2007/09/20 21:12:13 wiz Exp $
From FreeBSD's GNOME development repository.
--- lib/write.c.orig 2006-04-10 10:41:46.000000000 +0200
+++ lib/write.c
@@ -22,6 +22,7 @@
*/
#include <config.h>
+#include <errno.h>
#include <glibtop/write.h>
#include <glibtop/error.h>
@@ -42,15 +43,19 @@ glibtop_write_l (glibtop *server, size_t
fprintf (stderr, "LIBRARY: really writing %d bytes.\n", (int)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,
ngettext("wrote %d byte",
"wrote %d bytes", size),
(int) size);
+ }
}

View file

@ -1,30 +0,0 @@
$NetBSD: patch-bg,v 1.1 2007/09/20 21:12:14 wiz Exp $
--- sysdeps/freebsd/prockernel.c.orig 2006-06-13 22:20:53.000000000 +0200
+++ sysdeps/freebsd/prockernel.c
@@ -56,11 +56,7 @@
#endif
#ifdef __NetBSD__
-#include <machine/vmparam.h>
-#include <machine/pmap.h>
-#ifdef __arm32__
-#define KERNBASE KERNEL_BASE
-#endif
+#include <sys/resourcevar.h>
#endif
@@ -116,8 +112,10 @@ glibtop_get_proc_kernel_p (glibtop *serv
/* 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 >= 500013)

View file

@ -0,0 +1,13 @@
$NetBSD: patch-ca,v 1.1 2007/11/05 19:06:06 drochner Exp $
--- sysdeps/bsd/netload.c.orig 2007-05-12 23:54:57.000000000 +0200
+++ sysdeps/bsd/netload.c
@@ -233,7 +233,7 @@ glibtop_get_netload_p (glibtop *server,
buf->flags |= GLIBTOP_NETLOAD_ADDRESS6;
}
/* FIXME prefix6, scope6 */
-#if defined (__OpenBSD__)
+#if defined (__OpenBSD__) || defined(__NetBSD__)
ifaddraddr = (u_long) ifaddr.ifa.ifa_list.tqe_next;
#else
ifaddraddr = (u_long) ifaddr.ifa.ifa_link.tqe_next;

View file

@ -0,0 +1,12 @@
$NetBSD: patch-cb,v 1.1 2007/11/05 19:06:06 drochner Exp $
--- sysdeps/bsd/glibtop_server.h.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/glibtop_server.h
@@ -45,6 +45,7 @@ G_BEGIN_DECLS
#define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD)
#define GLIBTOP_SUID_NETLIST 0
#define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP)
+#define GLIBTOP_SUID_PROC_WD 0
G_END_DECLS

View file

@ -0,0 +1,35 @@
$NetBSD: patch-cc,v 1.1 2007/11/05 19:06:06 drochner Exp $
--- sysdeps/bsd/procopenfiles.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procopenfiles.c
@@ -47,5 +47,30 @@ _glibtop_init_proc_open_files_s (glibtop
glibtop_open_files_entry *
glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pid_t pid)
{
+ memset(buf, 0, sizeof (glibtop_proc_open_files));
+ return NULL;
+}
+
+#include <glibtop/procwd.h>
+
+static const unsigned long _glibtop_sysdeps_proc_wd =
+(1 << GLIBTOP_PROC_WD_EXE) |
+(1 << GLIBTOP_PROC_WD_ROOT) |
+(1 << GLIBTOP_PROC_WD_NUMBER);
+
+/* Init function. */
+
+void
+_glibtop_init_proc_wd_s (glibtop *server)
+{
+ server->sysdeps.proc_wd = _glibtop_sysdeps_proc_wd;
+}
+
+
+/* XXX Unimplemented on BSD */
+char **
+glibtop_get_proc_wd_s (glibtop *server, glibtop_proc_wd *buf, pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_wd));
return NULL;
}

View file

@ -0,0 +1,55 @@
$NetBSD: patch-cd,v 1.1 2007/11/05 19:06:06 drochner Exp $
--- sysdeps/bsd/procargs.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procargs.c
@@ -47,12 +47,16 @@ char *
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
char *retval, **args, **ptr;
size_t size = 0, pos = 0;
int count;
-#ifndef __bsdi__
+#if !defined(__bsdi__) && !defined(__NetBSD)
char filename [BUFSIZ];
struct stat statb;
#endif
@@ -64,7 +68,7 @@ glibtop_get_proc_args_p (glibtop *server
/* swapper, init, pagedaemon, vmdaemon, update - this doen't work. */
if (pid < 5) return NULL;
-#ifndef __bsdi__
+#if !defined(__bsdi__) && !defined(__NetBSD__)
sprintf (filename, "/proc/%d/mem", pid);
if (stat (filename, &statb)) return NULL;
#endif
@@ -72,14 +76,23 @@ glibtop_get_proc_args_p (glibtop *server
glibtop_suid_enter (server);
/* Get the process data */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count < 1)) {
glibtop_suid_leave (server);
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return NULL;
}
+#if defined(__NetBSD__)
+ args = kvm_getargv2 (server->machine.kd, pinfo, max_len);
+#else
args = kvm_getargv (server->machine.kd, pinfo, max_len);
+#endif
if (args == NULL) {
glibtop_suid_leave (server);
glibtop_warn_io_r (server, "kvm_getargv (%d)", pid);