← Back to team overview

cuneiform team mailing list archive

Re: FreeBSD port, take 2

 

On Thu, 2009-02-19 at 18:37 +0300, Yury V. Zaytsev wrote:
> On Thu, 2009-02-19 at 17:01 +0200, Jussi Pakkanen wrote:
> 
> > In this case you should just get rid of the useless #elif clause entirely.
> 
> OK, thank you for your comment. I did it that way because every "else"
> clause had the directive to include malloc.h while on FreeBSD no file
> needs to be included, as those functions are moved to stdlib.h.
 
OK, here goes yet another patch with help of alastair @ #freebsd /
FreeNode. It appears that malloc_usable_size is defined in malloc_np.h
in FreeBSD 7+ (7.x, 8.x). Compiling for FreeBSD 6.x is only possible
with some external memory manager like dlmalloc, because
malloc_usable_size in not implemented in libc. 

Could someone please test this? If it works, then we should figure out a
way to discriminate between FreeBSD 6 and later and require dlmalloc if
malloc_usable_size is unavailable.
 
-- 
Sincerely yours,
Yury V. Zaytsev
=== modified file 'cuneiform_src/Kern/rbal/src/statsearchbl.cpp'
--- cuneiform_src/Kern/rbal/src/statsearchbl.cpp	2009-01-21 14:52:06 +0000
+++ cuneiform_src/Kern/rbal/src/statsearchbl.cpp	2009-02-20 11:48:10 +0000
@@ -67,11 +67,10 @@
 #define malloc_usable_size(a) malloc_size(a)
 
 #elif defined(__FreeBSD__)
-/* freebsd system malloc don`t work correctly with malloc_usable_size in c++ */
-#include <dlmalloc/malloc.h>
+#include <malloc_np.h>
 
 #elif defined(WIN32)
-#include<malloc.h>
+#include <malloc.h>
 #define malloc_usable_size(a) _msize(a)
 
 #else

=== modified file 'cuneiform_src/Kern/windummy.c'
--- cuneiform_src/Kern/windummy.c	2009-02-02 17:08:58 +0000
+++ cuneiform_src/Kern/windummy.c	2009-02-20 11:49:04 +0000
@@ -55,9 +55,10 @@
 #if defined(__APPLE__) && defined(__MACH__)
 #include <malloc/malloc.h>
 #define malloc_usable_size(a) malloc_size(a)
+
 #elif defined(__FreeBSD__)
-/* freebsd system malloc don`t work correctly with malloc_usable_size in c++ */
-#include <dlmalloc/malloc.h>
+#include <malloc_np.h>
+
 #else
 #include <malloc.h>
 #endif


Follow ups

References