[med-svn] r18737 - in trunk/packages/vsearch/trunk/debian: . patches

Andreas Tille tille at moszumanska.debian.org
Thu Feb 5 08:11:11 UTC 2015


Author: tille
Date: 2015-02-05 08:10:52 +0000 (Thu, 05 Feb 2015)
New Revision: 18737

Added:
   trunk/packages/vsearch/trunk/debian/patches/sysconf_memory_sizing.patch
Modified:
   trunk/packages/vsearch/trunk/debian/changelog
   trunk/packages/vsearch/trunk/debian/patches/series
Log:
use more portable sysconf for memory sizing


Modified: trunk/packages/vsearch/trunk/debian/changelog
===================================================================
--- trunk/packages/vsearch/trunk/debian/changelog	2015-02-03 13:16:44 UTC (rev 18736)
+++ trunk/packages/vsearch/trunk/debian/changelog	2015-02-05 08:10:52 UTC (rev 18737)
@@ -12,6 +12,9 @@
   * Fix build issue on Hurd (Thanks for the hint to Samuel Thibault
     <sthibault at debian.org>)
     Closes: #776815
+  * Fix build issue on BSD by using the POSIX sysconf(3) (Thanks for the
+    patch to Jeff Epler <jepler at unpythonic.net>)
+    Closes: #776814
 
  -- Andreas Tille <tille at debian.org>  Mon, 02 Feb 2015 07:40:07 +0100
 

Modified: trunk/packages/vsearch/trunk/debian/patches/series
===================================================================
--- trunk/packages/vsearch/trunk/debian/patches/series	2015-02-03 13:16:44 UTC (rev 18736)
+++ trunk/packages/vsearch/trunk/debian/patches/series	2015-02-05 08:10:52 UTC (rev 18737)
@@ -3,3 +3,4 @@
 hardening.patch
 manpage_syntax.patch
 fix_build_issue_on_hurd.patch
+sysconf_memory_sizing.patch

Added: trunk/packages/vsearch/trunk/debian/patches/sysconf_memory_sizing.patch
===================================================================
--- trunk/packages/vsearch/trunk/debian/patches/sysconf_memory_sizing.patch	                        (rev 0)
+++ trunk/packages/vsearch/trunk/debian/patches/sysconf_memory_sizing.patch	2015-02-05 08:10:52 UTC (rev 18737)
@@ -0,0 +1,36 @@
+Description: <short summary of the patch>
+ By using the POSIX sysconf(3) together with the nonstandard extension
+ _SC_PHYS_PAGES, the system's installed memory can be queried portably on
+ Linux and kFreeBSD.
+Author: Jeff Epler <jepler at unpythonic.net>
+Bug-Debian: https://bugs.debian.org/776814
+Forwarded: no
+Last-Update: Wed, 04 Feb 2015 10:26:21 -0600
+
+--- a/src/arch.cc
++++ b/src/arch.cc
+@@ -21,6 +21,8 @@
+ 
+ #include "vsearch.h"
+ 
++#include <unistd.h>
++
+ unsigned long arch_get_memused()
+ {
+   struct rusage r_usage;
+@@ -44,6 +46,15 @@ unsigned long arch_get_memtotal()
+   if(-1 == sysctl(mib, 2, &ram, &length, NULL, 0))
+     fatal("Cannot determine amount of RAM");
+   return ram;
++#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
++  long phys_pages = sysconf(_SC_PHYS_PAGES),
++       pagesize = sysconf(_SC_PAGESIZE);
++  // sysconf(3) notes that pagesize * phys_pages can overflow, such as
++  // when long is 32-bits and there's more than 4GB RAM.  Since vsearch
++  // apparently targets LP64 systems like x86_64 linux, this will not
++  // arise in practice on the intended platform.
++  if( pagesize > LONG_MAX / phys_pages )  return LONG_MAX;
++  return pagesize * phys_pages;
+ #else
+   struct sysinfo si;
+   if (sysinfo(&si))




More information about the debian-med-commit mailing list