head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.50 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.48 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.46 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.44 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.42 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.40 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.38 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.36 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.34 pkgsrc-2008Q2-base:1.2 pkgsrc-2008Q1:1.2.0.32 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.30 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.28 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.26 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.24 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.22 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.20 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.2.0.18 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.2.0.16 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.2.0.14 pkgsrc-2005Q4-base:1.2 pkgsrc-2005Q3:1.2.0.12 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.10 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.2.0.8 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.2.0.6 pkgsrc-2004Q4-base:1.2 pkgsrc-2004Q3:1.2.0.4 pkgsrc-2004Q3-base:1.2 pkgsrc-2004Q2:1.2.0.2 pkgsrc-2004Q2-base:1.2 pkgsrc-2004Q1:1.1.1.1.0.6 pkgsrc-2004Q1-base:1.1.1.1 pkgsrc-2003Q4:1.1.1.1.0.4 pkgsrc-2003Q4-base:1.1.1.1 netbsd-1-6-1:1.1.1.1.0.2 netbsd-1-6-1-base:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.2 date 2004.04.01.18.34.27; author jmmv; state dead; branches; next 1.1; 1.1 date 2002.11.04.02.56.17; author rh; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2002.11.04.02.56.17; author rh; state Exp; branches; next ; desc @@ 1.2 log @Update to 2.5.2: - plenty of code cleanups - removed the dependency on libgnome, only glib required now - Linux 2.6 support, NetBSD support and better FreeBSD support - Make the block size available for filesystem statistics @ text @$NetBSD: patch-ae,v 1.1 2002/11/04 02:56:17 rh Exp $ --- sysdeps/freebsd/cpu.c.orig Sun Feb 13 16:47:58 2000 +++ sysdeps/freebsd/cpu.c @@@@ -27,11 +27,16 @@@@ #include +#ifdef __NetBSD__ +#include +#endif + static const unsigned long _glibtop_sysdeps_cpu = (1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) + (1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY); +#ifndef KERN_CP_TIME /* nlist structure for kernel access */ static struct nlist nlst [] = { #ifdef __bsdi__ @@@@ -41,21 +46,27 @@@@ #endif { 0 } }; +#endif /* MIB array for sysctl */ static int mib_length=2; static int mib [] = { CTL_KERN, KERN_CLOCKRATE }; +#ifdef KERN_CP_TIME +static int mib2 [] = { CTL_KERN, KERN_CP_TIME }; +#endif /* Init function. */ void glibtop_init_cpu_p (glibtop *server) { +#ifndef KERN_CP_TIME if (kvm_nlist (server->machine.kd, nlst) < 0) { glibtop_warn_io_r (server, "kvm_nlist (cpu)"); return; } +#endif /* Set this only if kvm_nlist () succeeded. */ server->sysdeps.cpu = _glibtop_sysdeps_cpu; } @@@@ -65,7 +76,11 @@@@ void glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf) { +#ifdef KERN_CP_TIME + u_int64_t cpts [CPUSTATES]; +#else long cpts [CPUSTATES]; +#endif /* sysctl vars*/ struct clockinfo ci; size_t length; @@@@ -78,11 +93,19 @@@@ if (server->sysdeps.cpu == 0) return; +#ifdef KERN_CP_TIME + length = sizeof (cpts); + if (sysctl (mib2, mib_length, cpts, &length, NULL, 0)) { + glibtop_warn_io_r (server, "sysctl"); + return; + } +#else if (kvm_read (server->machine.kd, nlst [0].n_value, &cpts, sizeof (cpts)) != sizeof (cpts)) { glibtop_warn_io_r (server, "kvm_read (cp_time)"); return; } +#endif /* Get the clockrate data */ length = sizeof (struct clockinfo); @ 1.1 log @Initial revision @ text @d1 1 a1 1 $NetBSD: patch-ae,v 1.8 2001/07/17 11:02:02 wiz Exp $ @ 1.1.1.1 log @Initial import of libgtop2-2.0.0, a library to retrieve system information, used in GNOME2 @ text @@