diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2018-08-20 15:28:16 +0200 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-08-21 16:44:04 +0000 |
commit | 0f86ed9f8be0666bb49252daa24b2db6aa174199 (patch) | |
tree | afe784b649e919a68243c15ab4cf7dab24684386 /libglusterfs | |
parent | fcd0c24abfccfe8d1faf64269a113596577355a8 (diff) |
Fix physical memory detection on NetBSD
NetBSD has two sysctl for physical memory detection: hw.physmem and
hw.physmem64. Only the later is 64-bit proof, and it has been
available for years.
That fix is important because it cause recent glusterfs to refuse
mounting fileystems when there is too much RAM, with an error loading
the quick-read xlator
[quick-read.c:838:check_cache_size_ok] 0-gfs-quick-read:
Cache size 134217728 is greater than the max size of 0
Change-Id: I957a1ff1d7018fe2f9d47384a28708e6cbdf710a
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Fixes: bz#1619475
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 9dd030aa6c4..06636a1fa85 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -2877,13 +2877,23 @@ get_mem_size () memsize = page_size * num_pages; #endif -#if defined GF_BSD_HOST_OS || defined GF_DARWIN_HOST_OS +#if defined GF_DARWIN_HOST_OS size_t len = sizeof(memsize); int name [] = { CTL_HW, HW_PHYSMEM }; sysctl (name, 2, &memsize, &len, NULL, 0); #endif + +#if defined __NetBSD__ + + size_t len = sizeof(memsize); + int name64 [] = { CTL_HW, HW_PHYSMEM64 }; + + sysctl (name64, 2, &memsize, &len, NULL, 0); + if (memsize == -1) + sysctl (name64, 2, &memsize, &len, NULL, 0); +#endif return memsize; } |