From c149fc1d2776603ecc61ccf7a42b17a3e3a9e834 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Fri, 5 Sep 2008 14:32:32 +0000 Subject: [PATCH] (win32) Add getpagesize() and getregionsize() implementations --- libtransmission/platform.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libtransmission/platform.c b/libtransmission/platform.c index 8eec9926e..397ffb7f5 100644 --- a/libtransmission/platform.c +++ b/libtransmission/platform.c @@ -661,6 +661,27 @@ static int slrelease (LONG *sl) { return 0; } +/* getpagesize for windows */ +static long getpagesize (void) { + static long g_pagesize = 0; + if (! g_pagesize) { + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + g_pagesize = system_info.dwPageSize; + } + return g_pagesize; +} + +static long getregionsize (void) { + static long g_regionsize = 0; + if (! g_regionsize) { + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + g_regionsize = system_info.dwAllocationGranularity; + } + return g_regionsize; +} + void *mmap (void *ptr, long size, long prot, long type, long handle, long arg) { static long g_pagesize; static long g_regionsize;