For a specific slice of kernel versions we can get a better
estimate of the available memory before the "real" available
figure appears around kernel 3.2
However, that middle method requires a /proc/sys/vm directory.
FreeBSD 9.x used to emulate a < 2.6.27 kernel procfs meaning
it never tried the middle method. FreeBSD 10.x emulates something
more modern, but without the available figure and without a
/proc/sys/vm, so the library falls into a hole.
Hurd may to one day have this bug so we'll exclude him as well
as its triggered by whatever number appears in
/proc/sys/kernel/osrelease
References:
commit
3f3b1a59ada85d21f34530cfb1dc1c0afd70e6dc
https://bugs.debian.org/831396
procps-ng-NEXT
----------------
* watch: define HOST_NAME_MAX where not defined Debian #830734
+ * library: dont use vm_min_free on non Linux Debian #831396
procps-ng-3.3.12
----------------
/* zero? might need fallback for 2.6.27 <= kernel <? 3.14 */
if (!kb_main_available) {
+#ifdef __linux__
if (linux_version_code < LINUX_VERSION(2, 6, 27))
kb_main_available = kb_main_free;
else {
if (mem_available < 0) mem_available = 0;
kb_main_available = (unsigned long)mem_available;
}
+#else
+ kb_main_available = kb_main_free;
+#endif /* linux */
}
}