[SciPy-user] shared memory machines

Philip Semanchuk philip@semanchuk....
Mon Feb 9 10:48:58 CST 2009


On Feb 9, 2009, at 11:24 AM, Robert Kern wrote:

> On Mon, Feb 9, 2009 at 09:28, Philip Semanchuk  
> <philip@semanchuk.com> wrote:
>> Also, is it consistent with your license to use code from Python
>> itself? If so, then I have another minor suggestion.
>
> Yup.

I'm not sure how prevalent the getpagesize() API is. You might want to  
consider using the following code (from Python's mmapmodule.c) to get  
the page size.

#ifdef MS_WINDOWS
#include <windows.h>
static int
my_getpagesize(void)
{
	SYSTEM_INFO si;
	GetSystemInfo(&si);
	return si.dwPageSize;
}
#endif

#ifdef UNIX
#include <sys/mman.h>
#include <sys/stat.h>

#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
static int
my_getpagesize(void)
{
	return sysconf(_SC_PAGESIZE);
}
#else
#define my_getpagesize getpagesize
#endif

#endif /* UNIX */



More information about the SciPy-user mailing list