Please build test libsysactivity 0.5.4-5 on x86 BSD machine with > 4 GB RAM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi
As the subject suggests I would like a build test of libsysactivity on an
x86 machine with 4 GB RAM (or more). The new version of libsysactivity
carries some patches to properly calculate memory on BSD machines.
The problem I would like to assert that the patches fix is that there
are no longer integer overflows when calculating memory on a x86 BSD
machine with 4 GB RAM.[1]
libsysactivity 0.5.4-5 is available from:
- http://mentors.debian.net/debian/pool/main/l/libsysactivity/libsysactivity_0.5.4-5.dsc
- git clone git://git.debian.org/collab-maint/libsysactivity.git
You can also just fetch 0.5.4-4 from the archive and apply the attached
debdiff.
Thank you in advance,
~Niels
Note: I am not subscribed to any of the BSD lists; please CC me directly,
if you for some reason do not want to CC the bug.
[1] The observant reader will notice that the patches also fix an issue
for 64bit machines. Feel free to do a verification test of that as well if
you got a 64 bit machine with +4 GB RAM; however I already got a
successful test build with those. :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Topal (http://freshmeat.net/projects/topal)
iEYEAREIAAYFAkyKD38ACgkQVCqoiq1YlqxFTwCfdTo3FOj8gqNfXRYPJLtxpSiA
r4cAoOXFwM7CEwhpIbuMMfx8DjczGgZT
=N2U2
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEUEABEIAAYFAkyKDeQACgkQVCqoiq1YlqzEnwCY0qgeciuPAvwt3ieMsFk0YUjZ
YACfQK12MTI/3SZJX6UnaPnp0w2nyUE=
=js8G
-----END PGP SIGNATURE-----
Description: Packaging diff between 0.5.4-4 and 0.5.4-5.
.
Assumes patches have been applied and will apply new paches.
diff --git a/debian/changelog b/debian/changelog
index 33fc5a8..0253e5a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+libsysactivity (0.5.4-5) unstable; urgency=low
+
+ * Added patch to fix the issue with calculating memory on kFreeBSD
+ based architectures for machines with > 4 GB RAM.
+ (Closes: #594594)
+ * Added patch to disable "cpu idle" test, which causes build
+ failures due to false positives.
+
+ -- Niels Thykier <niels@thykier.net> Fri, 10 Sep 2010 12:11:25 +0200
+
libsysactivity (0.5.4-4) unstable; urgency=low
* Applied patch from upstream to fix an issue with calculating memory
diff --git a/debian/patches/disable-cpu-idle-test.patch b/debian/patches/disable-cpu-idle-test.patch
new file mode 100644
index 0000000..bddf75e
--- /dev/null
+++ b/debian/patches/disable-cpu-idle-test.patch
@@ -0,0 +1,17 @@
+Description: Disables the "cpu idle" test; the test causes
+ build failures due to false positives.
+Origin: upstream
+
+diff --git a/test/test_cpu.c b/test/test_cpu.c
+index ae5b35a..44d86ef 100644
+--- a/test/test_cpu.c
++++ b/test/test_cpu.c
+@@ -58,7 +58,7 @@ void print_cpu_info(struct sa_cpu* cpu) {
+ }
+
+ void test_cpu_info(struct sa_cpu* cpu) {
+-#ifdef SA_CPU_IDLE
++#if 0
+ if (cpu->idle != 0) {
+ printf("\nERROR: Idle is not zero\n");
+ exit(EXIT_FAILURE);
diff --git a/debian/patches/freebsd-memory-64bit.patch b/debian/patches/freebsd-memory-64bit.patch
new file mode 100644
index 0000000..f20cb50
--- /dev/null
+++ b/debian/patches/freebsd-memory-64bit.patch
@@ -0,0 +1,66 @@
+Description: Backported fix for an int overflow when
+ calculating memory on FreeBSD machines.
+ .
+ Note: this is a partial patch which is needed together
+ with freebsd-memory-int-overflow.patch
+Origin: upstream
+Bug-Debian: http://bugs.debian.org/593018
+
+diff --git a/src/FreeBSD/memory.c b/src/FreeBSD/memory.c
+index 4c57efa..1897943 100644
+--- a/src/FreeBSD/memory.c
++++ b/src/FreeBSD/memory.c
+@@ -53,35 +53,37 @@ int sa_get_memory(struct sa_memory* dst) {
+ if (dst == NULL)
+ return EINVAL;
+
+- size_t tmp;
+- size_t len = sizeof dst;
+- if (sysctlbyname("hw.physmem", &tmp, &len, NULL, 0) == -1)
++ uint64_t tmp64 = 0;
++ size_t len = sizeof tmp64;
++ if (sysctlbyname("hw.physmem", &tmp64, &len, NULL, 0) == -1)
+ return ENOSYS;
+- dst->total = tmp;
++ dst->total = tmp64;
+
+- if (sysctlbyname("vm.stats.vm.v_free_count", &tmp, &len, NULL, 0) == -1)
++ if (sysctlbyname("vfs.bufspace", &tmp64, &len, NULL, 0) == -1)
+ return ENOSYS;
+- dst->free = tmp * page_size;
++ dst->buffers = tmp64;
+
+- if (sysctlbyname("vfs.bufspace", &tmp, &len, NULL, 0) == -1)
++ uint32_t tmp32;
++ len = sizeof tmp32;
++ if (sysctlbyname("vm.stats.vm.v_free_count", &tmp32, &len, NULL, 0) == -1)
+ return ENOSYS;
+- dst->buffers = tmp;
++ dst->free = (uint64_t) tmp32 * page_size;
+
+- if (sysctlbyname("vm.stats.vm.v_cache_count", &tmp, &len, NULL, 0) == -1)
++ if (sysctlbyname("vm.stats.vm.v_cache_count", &tmp32, &len, NULL, 0) == -1)
+ return ENOSYS;
+- dst->cached = tmp * page_size;
++ dst->cached = (uint64_t) tmp32 * page_size;
+
+- if (sysctlbyname("vm.stats.vm.v_active_count", &tmp, &len, NULL, 0) == -1)
++ if (sysctlbyname("vm.stats.vm.v_active_count", &tmp32, &len, NULL, 0) == -1)
+ return ENOSYS;
+- dst->active = tmp * page_size;
++ dst->active = (uint64_t) tmp32 * page_size;
+
+- if (sysctlbyname("vm.stats.vm.v_inactive_count", &tmp, &len, NULL, 0) == -1)
++ if (sysctlbyname("vm.stats.vm.v_inactive_count", &tmp32, &len, NULL, 0) == -1)
+ return ENOSYS;
+- dst->inactive = tmp * page_size;
++ dst->inactive = (uint64_t) tmp32 * page_size;
+
+- if (sysctlbyname("vm.stats.vm.v_wire_count", &tmp, &len, NULL, 0) == -1)
++ if (sysctlbyname("vm.stats.vm.v_wire_count", &tmp32, &len, NULL, 0) == -1)
+ return ENOSYS;
+- dst->wired = tmp * page_size;
++ dst->wired = (uint64_t) tmp32 * page_size;
+
+ struct xswdev xsw;
+ size_t size = sizeof xsw;
diff --git a/debian/patches/freebsd-memory-int-overflow.patch b/debian/patches/freebsd-memory-int-overflow.patch
index 717bd01..11bf390 100644
--- a/debian/patches/freebsd-memory-int-overflow.patch
+++ b/debian/patches/freebsd-memory-int-overflow.patch
@@ -1,5 +1,8 @@
Description: Backported fix for an int overflow when
calculating memory on FreeBSD machines.
+ .
+ Note: this is a partial patch which is needed together
+ with freebsd-memory-64bit.patch.
Origin: upstream
Bug-Debian: http://bugs.debian.org/593018
diff --git a/debian/patches/series b/debian/patches/series
index 006f4bf..eb0dccd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,5 @@ remove-devstat.h.patch
fix-tests.patch
mem-swap-issue.patch
freebsd-memory-int-overflow.patch
+freebsd-memory-64bit.patch
+disable-cpu-idle-test.patch
diff --git a/src/FreeBSD/memory.c b/src/FreeBSD/memory.c
index 4c57efa..1897943 100644
--- a/src/FreeBSD/memory.c
+++ b/src/FreeBSD/memory.c
@@ -53,35 +53,37 @@ int sa_get_memory(struct sa_memory* dst) {
if (dst == NULL)
return EINVAL;
- size_t tmp;
- size_t len = sizeof dst;
- if (sysctlbyname("hw.physmem", &tmp, &len, NULL, 0) == -1)
+ uint64_t tmp64 = 0;
+ size_t len = sizeof tmp64;
+ if (sysctlbyname("hw.physmem", &tmp64, &len, NULL, 0) == -1)
return ENOSYS;
- dst->total = tmp;
+ dst->total = tmp64;
- if (sysctlbyname("vm.stats.vm.v_free_count", &tmp, &len, NULL, 0) == -1)
+ if (sysctlbyname("vfs.bufspace", &tmp64, &len, NULL, 0) == -1)
return ENOSYS;
- dst->free = tmp * page_size;
+ dst->buffers = tmp64;
- if (sysctlbyname("vfs.bufspace", &tmp, &len, NULL, 0) == -1)
+ uint32_t tmp32;
+ len = sizeof tmp32;
+ if (sysctlbyname("vm.stats.vm.v_free_count", &tmp32, &len, NULL, 0) == -1)
return ENOSYS;
- dst->buffers = tmp;
+ dst->free = (uint64_t) tmp32 * page_size;
- if (sysctlbyname("vm.stats.vm.v_cache_count", &tmp, &len, NULL, 0) == -1)
+ if (sysctlbyname("vm.stats.vm.v_cache_count", &tmp32, &len, NULL, 0) == -1)
return ENOSYS;
- dst->cached = tmp * page_size;
+ dst->cached = (uint64_t) tmp32 * page_size;
- if (sysctlbyname("vm.stats.vm.v_active_count", &tmp, &len, NULL, 0) == -1)
+ if (sysctlbyname("vm.stats.vm.v_active_count", &tmp32, &len, NULL, 0) == -1)
return ENOSYS;
- dst->active = tmp * page_size;
+ dst->active = (uint64_t) tmp32 * page_size;
- if (sysctlbyname("vm.stats.vm.v_inactive_count", &tmp, &len, NULL, 0) == -1)
+ if (sysctlbyname("vm.stats.vm.v_inactive_count", &tmp32, &len, NULL, 0) == -1)
return ENOSYS;
- dst->inactive = tmp * page_size;
+ dst->inactive = (uint64_t) tmp32 * page_size;
- if (sysctlbyname("vm.stats.vm.v_wire_count", &tmp, &len, NULL, 0) == -1)
+ if (sysctlbyname("vm.stats.vm.v_wire_count", &tmp32, &len, NULL, 0) == -1)
return ENOSYS;
- dst->wired = tmp * page_size;
+ dst->wired = (uint64_t) tmp32 * page_size;
struct xswdev xsw;
size_t size = sizeof xsw;
diff --git a/test/test_cpu.c b/test/test_cpu.c
index ae5b35a..44d86ef 100644
--- a/test/test_cpu.c
+++ b/test/test_cpu.c
@@ -58,7 +58,7 @@ void print_cpu_info(struct sa_cpu* cpu) {
}
void test_cpu_info(struct sa_cpu* cpu) {
-#ifdef SA_CPU_IDLE
+#if 0
if (cpu->idle != 0) {
printf("\nERROR: Idle is not zero\n");
exit(EXIT_FAILURE);
Reply to: