diff --git a/ChangeLog b/ChangeLog index d339b7c71..38aa12fa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-06-15 Richard Frith-Macdonald + + * Source/NSInvocation: For portability, use NSPageSize() to find + size for page alignment. + 2010-06-15 Riccardo Mottola * Source/NSInvocation: diff --git a/Source/NSInvocation.m b/Source/NSInvocation.m index 17d63eb52..316db63fd 100644 --- a/Source/NSInvocation.m +++ b/Source/NSInvocation.m @@ -31,6 +31,7 @@ #import "Foundation/NSException.h" #import "Foundation/NSCoder.h" #import "Foundation/NSInvocation.h" +#import "Foundation/NSZone.h" #import "GSInvocation.h" #import "GSPrivate.h" #import "GNUstepBase/NSObject+GNUstepBase.h" @@ -81,7 +82,7 @@ VirtualFree(buffer, 0, MEM_RELEASE); #else #if defined(HAVE_MPROTECT) - if (mprotect(buffer,sysconf(_SC_PAGESIZE), PROT_READ|PROT_WRITE) == -1) + if (mprotect(buffer, NSPageSize(), PROT_READ|PROT_WRITE) == -1) { NSLog(@"Failed to protect memory as writable: %@", [NSError _last]); } @@ -114,8 +115,8 @@ buffer = VirtualAlloc(NULL, _size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); #else // buffer = malloc(_size); - NSAssert(_size < sysconf(_SC_PAGESIZE), @"Tried to allocate more than one page."); - buffer = valloc(sysconf(_SC_PAGESIZE)); + NSAssert(_size < NSPageSize(), @"Tried to allocate more than one page."); + buffer = valloc(NSPageSize()); #endif /* HAVE_MMAP */ if (buffer == (void*)0) @@ -144,7 +145,7 @@ NSLog(@"Failed to protect memory as executable: %@", [NSError _last]); } #elif defined(HAVE_MPROTECT) - if (mprotect(buffer,sysconf(_SC_PAGESIZE), PROT_READ|PROT_EXEC) == -1) + if (mprotect(buffer, NSPageSize(), PROT_READ|PROT_EXEC) == -1) { NSLog(@"Failed to protect memory as executable: %@", [NSError _last]); }