@matheusbsbs / matheus-bagliano / commits / b1b952043f
Fork 0

MSVC: Add support for building with NO_MMAP

When the NO_MMAP build variable is set, the msvc linker complains: error LNK2001: unresolved external symbol _getpagesize The msvc libraries do not define the getpagesize() function, so we move the mingw_getpagesize() implementation from the conditionally built win32mmap.c file to mingw.c. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Nov 7, 2009 at 20:10 UTC b1b952043f8f909649fdf053c371109c84f9cf56
3 files changed +13 -13
compat/mingw.c
+12
@@ -1000,6 +1000,18 @@ repeat:
1000 return -1;
1001 }
1002
1003 +/*
1004 + * Note that this doesn't return the actual pagesize, but
1005 + * the allocation granularity. If future Windows specific git code
1006 + * needs the real getpagesize function, we need to find another solution.
1007 + */
1008 +int mingw_getpagesize(void)
1009 +{
1010 + SYSTEM_INFO si;
1011 + GetSystemInfo(&si);
1012 + return si.dwAllocationGranularity;
1013 +}
1014 +
1015 struct passwd *getpwuid(int uid)
1016 {
1017 static char user_name[100];
compat/mingw.h
+1 -1
@@ -166,7 +166,7 @@ int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz);
166 int mingw_rename(const char*, const char*);
167 #define rename mingw_rename
168
169 -#ifdef USE_WIN32_MMAP
169 +#if defined(USE_WIN32_MMAP) || defined(_MSC_VER)
170 int mingw_getpagesize(void);
171 #define getpagesize mingw_getpagesize
172 #endif
compat/win32mmap.c
-12
@@ -1,17 +1,5 @@
1 #include "../git-compat-util.h"
2
3 -/*
4 - * Note that this doesn't return the actual pagesize, but
5 - * the allocation granularity. If future Windows specific git code
6 - * needs the real getpagesize function, we need to find another solution.
7 - */
8 -int mingw_getpagesize(void)
9 -{
10 - SYSTEM_INFO si;
11 - GetSystemInfo(&si);
12 - return si.dwAllocationGranularity;
13 -}
14 -
3 void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
4 {
5 HANDLE hmap;