[Vm-dev] [commit] r2547 - Use the do-it-yourself asprintf in sqSCCSVersion.h since Mac OS's segfaults.

commits at squeakvm.org commits at squeakvm.org
Sun Apr 8 22:43:28 UTC 2012


Author: eliot
Date: 2012-04-08 15:43:27 -0700 (Sun, 08 Apr 2012)
New Revision: 2547

Modified:
   branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
   branches/Cog/platforms/Mac OS/vm/sqMacMemory.c
   branches/Cog/platforms/unix/vm/sqUnixMemory.c
Log:
Use the do-it-yourself asprintf in sqSCCSVersion.h since Mac OS's segfaults.
Fix the annoying bogus error messages from the mprotect calls by getting the
length arg to mprotect right.


Modified: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
===================================================================
--- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h	2012-04-05 19:21:49 UTC (rev 2546)
+++ branches/Cog/platforms/Cross/vm/sqSCCSVersion.h	2012-04-08 22:43:27 UTC (rev 2547)
@@ -63,7 +63,7 @@
 sourceVersionString(char separator)
 {
 	if (!sourceVersion) {
-#if WIN32
+#if 1 /* a) mingw32 doesn't have asprintf and b) on Mac OS it segfaults. */
 		char *fmt = "VM: r%s %s%cPlugins: r%s %s";
 		int len = strlen(fmt)
 				+ strlen(revisionAsString())


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Thu Apr  5 12:21:16 PDT 2012
   + Sun Apr  8 15:41:40 PDT 2012

Modified: branches/Cog/platforms/Mac OS/vm/sqMacMemory.c
===================================================================
--- branches/Cog/platforms/Mac OS/vm/sqMacMemory.c	2012-04-05 19:21:49 UTC (rev 2546)
+++ branches/Cog/platforms/Mac OS/vm/sqMacMemory.c	2012-04-08 22:43:27 UTC (rev 2547)
@@ -102,7 +102,7 @@
 {
 	unsigned long firstPage = roundDownToPageBoundary(startAddr);
 	if (mprotect((void *)firstPage,
-				 roundUpToPageBoundary(endAddr - firstPage),
+				 endAddr - firstPage + 1,
 				 PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
 		perror("mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC)");
 }
@@ -113,7 +113,7 @@
 	unsigned long firstPage = roundDownToPageBoundary(startAddr);
 	/* We get EACCESS on 10.6.3 when trying to disable exec perm; Why? */
 	if (mprotect((void *)firstPage,
-				 roundUpToPageBoundary(endAddr - firstPage),
+				 endAddr - firstPage + 1,
 				 PROT_READ | PROT_WRITE) < 0
 	 && errno != EACCES)
 		perror("mprotect(x,y,PROT_READ | PROT_WRITE)");

Modified: branches/Cog/platforms/unix/vm/sqUnixMemory.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixMemory.c	2012-04-05 19:21:49 UTC (rev 2546)
+++ branches/Cog/platforms/unix/vm/sqUnixMemory.c	2012-04-08 22:43:27 UTC (rev 2547)
@@ -297,7 +297,7 @@
 {
 	unsigned long firstPage = roundDownToPageBoundary(startAddr);
 	if (mprotect((void *)firstPage,
-				 roundUpToPageBoundary(endAddr - firstPage),
+				 endAddr - firstPage + 1,
 				 PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
 		perror("mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC)");
 }
@@ -307,7 +307,7 @@
 {
 	unsigned long firstPage = roundDownToPageBoundary(startAddr);
 	if (mprotect((void *)firstPage,
-				 roundUpToPageBoundary(endAddr - firstPage),
+				 endAddr - firstPage + 1,
 				 PROT_READ | PROT_WRITE) < 0)
 		perror("mprotect(x,y,PROT_READ | PROT_WRITE)");
 }



More information about the Vm-dev mailing list