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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 30 14:13:34 CDT 2009


Author: tilghman
Date: Thu Jul 30 14:13:31 2009
New Revision: 209595

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209595
Log:
Fixes for OpenBSD

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=209595&r1=209594&r2=209595
==============================================================================
--- team/tilghman/malloc_hold/main/astmm.c (original)
+++ team/tilghman/malloc_hold/main/astmm.c Thu Jul 30 14:13:31 2009
@@ -192,7 +192,7 @@
 					continue;
 				}
 
-				astmm_log("Intercepted invalid %s to %p (%p+%d), originally allocated in %s at %s:%d and freed in %s at %s:%d\n",
+				astmm_log("Intercepted invalid %s to %p (%p+%d), originally allocated in %s at %s:%u and freed in %s at %s:%u\n",
 					violations[last_seen_violation].error == PROT_READ ? "read" : "write",
 					violations[last_seen_violation].violation, cur->data,
 					violations[last_seen_violation].violation - (void *) cur->data,
@@ -232,7 +232,7 @@
 			if (cur->operation) {
 				for (i = 0; i < ARRAY_LEN(violations); i++) {
 					if (cur == violations[i].base_addr) {
-						astmm_log("Intercepted invalid %s to %p (%p+%d), originally allocated in %s at %s:%d and freed in %s at %s:%d\n",
+						astmm_log("Intercepted invalid %s to %p (%p+%d), originally allocated in %s at %s:%u and freed in %s at %s:%u\n",
 							violations[i].error == PROT_READ ? "read" : "write",
 							violations[i].violation, cur->data,
 							violations[i].violation - (void *) cur->data,
@@ -335,7 +335,8 @@
 		}
 	} else {
 		/* Error in astmm code */
-		if ((void *) cur->data > info->si_addr) {
+		if ((void *) cur->data > (void *) info->si_addr) {
+			/* Extra cast above due to OpenBSD */
 			abort();
 		}
 		/* We're about to modify, so let us write */
@@ -462,6 +463,9 @@
 
 	/* Do I need a new allocation? */
 #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__Darwin__)
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
 	if (!reg && (reg = mmap(NULL, fullsize, PROT_READ | PROT_WRITE, MAP_ANONYMOUS, -1, 0)) == MAP_FAILED) {
 #else
 	if (!reg && !(reg = memalign(pagesize, fullsize))) {




More information about the asterisk-commits mailing list