[asterisk-commits] tilghman: branch tilghman/malloc_hold r209515 - /team/tilghman/malloc_hold/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 29 17:48:25 CDT 2009


Author: tilghman
Date: Wed Jul 29 17:48:22 2009
New Revision: 209515

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209515
Log:
Possible change to make this debug mode work on the BSD platforms.

Modified:
    team/tilghman/malloc_hold/main/astmm.c

Modified: team/tilghman/malloc_hold/main/astmm.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/main/astmm.c?view=diff&rev=209515&r1=209514&r2=209515
==============================================================================
--- team/tilghman/malloc_hold/main/astmm.c (original)
+++ team/tilghman/malloc_hold/main/astmm.c Wed Jul 29 17:48:22 2009
@@ -385,7 +385,11 @@
 		MPROTECT(reg, reg->fullsize, PROT_READ | PROT_WRITE);
 		reg->operation = 0;
 		regions[FREE_LIST] = reg->next;
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__Darwin__)
+		munmap(reg, reg->fullsize);
+#else
 		free(reg);
+#endif
 	}
 	ast_mutex_unlock(&reglock);
 }
@@ -457,7 +461,11 @@
 	ast_mutex_unlock(&reglock);
 
 	/* Do I need a new allocation? */
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__Darwin__)
+	if (!reg && (reg = mmap(NULL, fullsize, PROT_READ | PROT_WRITE, MAP_ANONYMOUS, -1, 0)) == MAP_FAILED) {
+#else
 	if (!reg && !(reg = memalign(pagesize, fullsize))) {
+#endif
 #else /* !MALLOC_HOLD */
 	if (!(reg = malloc(size + sizeof(*reg) + sizeof(*fence)))) {
 #endif




More information about the asterisk-commits mailing list