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>
This commit is contained in:
parent
d691d84eed
commit
b1b952043f
@ -1000,6 +1000,18 @@ repeat:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that this doesn't return the actual pagesize, but
|
||||||
|
* the allocation granularity. If future Windows specific git code
|
||||||
|
* needs the real getpagesize function, we need to find another solution.
|
||||||
|
*/
|
||||||
|
int mingw_getpagesize(void)
|
||||||
|
{
|
||||||
|
SYSTEM_INFO si;
|
||||||
|
GetSystemInfo(&si);
|
||||||
|
return si.dwAllocationGranularity;
|
||||||
|
}
|
||||||
|
|
||||||
struct passwd *getpwuid(int uid)
|
struct passwd *getpwuid(int uid)
|
||||||
{
|
{
|
||||||
static char user_name[100];
|
static char user_name[100];
|
||||||
|
@ -166,7 +166,7 @@ int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz);
|
|||||||
int mingw_rename(const char*, const char*);
|
int mingw_rename(const char*, const char*);
|
||||||
#define rename mingw_rename
|
#define rename mingw_rename
|
||||||
|
|
||||||
#ifdef USE_WIN32_MMAP
|
#if defined(USE_WIN32_MMAP) || defined(_MSC_VER)
|
||||||
int mingw_getpagesize(void);
|
int mingw_getpagesize(void);
|
||||||
#define getpagesize mingw_getpagesize
|
#define getpagesize mingw_getpagesize
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
#include "../git-compat-util.h"
|
#include "../git-compat-util.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Note that this doesn't return the actual pagesize, but
|
|
||||||
* the allocation granularity. If future Windows specific git code
|
|
||||||
* needs the real getpagesize function, we need to find another solution.
|
|
||||||
*/
|
|
||||||
int mingw_getpagesize(void)
|
|
||||||
{
|
|
||||||
SYSTEM_INFO si;
|
|
||||||
GetSystemInfo(&si);
|
|
||||||
return si.dwAllocationGranularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
|
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
|
||||||
{
|
{
|
||||||
HANDLE hmap;
|
HANDLE hmap;
|
||||||
|
Loading…
Reference in New Issue
Block a user