Fix ncpu display on big endian.

This commit is contained in:
ajacoutot 2010-09-18 09:14:17 +00:00
parent 8cb52ae966
commit 91570903a6
2 changed files with 12 additions and 9 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.47 2010/04/18 12:51:44 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.48 2010/09/18 09:14:17 ajacoutot Exp $
COMMENT= portable library for obtaining system information
GNOME_VERSION= 2.28.1
GNOME_PROJECT= libgtop
PKGNAME= libgtop2-${VERSION}p8
PKGNAME= libgtop2-${VERSION}p9
SHARED_LIBS= gtop-2.0 9.0 # .9.0

View File

@ -1,17 +1,20 @@
$OpenBSD: patch-sysdeps_bsd_sysinfo_c,v 1.7 2010/04/18 09:49:22 ajacoutot Exp $
$OpenBSD: patch-sysdeps_bsd_sysinfo_c,v 1.8 2010/09/18 09:14:18 ajacoutot Exp $
--- sysdeps/bsd/sysinfo.c.orig Sun Apr 19 19:51:00 2009
+++ sysdeps/bsd/sysinfo.c Sat Apr 17 16:29:02 2010
@@ -37,6 +37,9 @@ init_sysinfo (glibtop *server)
+++ sysdeps/bsd/sysinfo.c Sat Sep 18 11:06:35 2010
@@ -36,7 +36,12 @@ static void
init_sysinfo (glibtop *server)
{
char *model;
guint64 ncpus = 1;
+#if defined(__OpenBSD__)
+ int mib[2];
+ int ncpus = 1;
+#else
guint64 ncpus = 1;
+#endif
int mhz = 0;
size_t len;
@@ -45,6 +48,34 @@ init_sysinfo (glibtop *server)
@@ -45,6 +50,34 @@ init_sysinfo (glibtop *server)
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
@ -46,7 +49,7 @@ $OpenBSD: patch-sysdeps_bsd_sysinfo_c,v 1.7 2010/04/18 09:49:22 ajacoutot Exp $
len = sizeof (ncpus);
sysctlbyname ("hw.ncpu", &ncpus, &len, NULL, 0);
len = 0;
@@ -54,6 +85,8 @@ init_sysinfo (glibtop *server)
@@ -54,6 +87,8 @@ init_sysinfo (glibtop *server)
len = sizeof (mhz);
sysctlbyname ("hw.clockrate", &mhz, &len, NULL, 0);
@ -55,7 +58,7 @@ $OpenBSD: patch-sysdeps_bsd_sysinfo_c,v 1.7 2010/04/18 09:49:22 ajacoutot Exp $
for (sysinfo.ncpu = 0;
sysinfo.ncpu < GLIBTOP_NCPU && sysinfo.ncpu < ncpus;
sysinfo.ncpu++) {
@@ -71,6 +104,10 @@ init_sysinfo (glibtop *server)
@@ -71,6 +106,10 @@ init_sysinfo (glibtop *server)
g_ptr_array_add (cpuinfo->labels, "vendor_id");
g_hash_table_insert (cpuinfo->values, "vendor_id",