{"thread":{"id":"21520","subject":"[PATCH v2 3/4] MSVC: Add support for building with NO_MMAP","startedAt":"2009-11-07T20:10:31Z","lastAt":"2009-11-07T20:10:31Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":2,"patchTotal":4},"messages":[{"id":"127053","messageId":"4AF5D437.8000307@ramsay1.demon.co.uk","threadId":"21520","inReplyTo":null,"subject":"[PATCH v2 3/4] MSVC: Add support for building with NO_MMAP","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2009-11-07T20:10:31Z","receivedAt":"2009-11-07T20:10:31Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nWhen the NO_MMAP build variable is set, the msvc linker complains:\n\n    error LNK2001: unresolved external symbol _getpagesize\n\nThe msvc libraries do not define the getpagesize() function,\nso we move the mingw_getpagesize() implementation from the\nconditionally built win32mmap.c file to mingw.c.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nChanges since v1:\n    - re-worded the subject and commit message to, hopefully,\n      make it a little clearer.\n\n compat/mingw.c     |   12 ++++++++++++\n compat/mingw.h     |    2 +-\n compat/win32mmap.c |   12 ------------\n 3 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 6b5b5b2..15fe33e 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1000,6 +1000,18 @@ repeat:\n \treturn -1;\n }\n \n+/*\n+ * Note that this doesn't return the actual pagesize, but\n+ * the allocation granularity. If future Windows specific git code\n+ * needs the real getpagesize function, we need to find another solution.\n+ */\n+int mingw_getpagesize(void)\n+{\n+\tSYSTEM_INFO si;\n+\tGetSystemInfo(&si);\n+\treturn si.dwAllocationGranularity;\n+}\n+\n struct passwd *getpwuid(int uid)\n {\n \tstatic char user_name[100];\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 5b5258b..26c4027 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -166,7 +166,7 @@ int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz);\n int mingw_rename(const char*, const char*);\n #define rename mingw_rename\n \n-#ifdef USE_WIN32_MMAP\n+#if defined(USE_WIN32_MMAP) || defined(_MSC_VER)\n int mingw_getpagesize(void);\n #define getpagesize mingw_getpagesize\n #endif\ndiff --git a/compat/win32mmap.c b/compat/win32mmap.c\nindex 779d796..1c5a149 100644\n--- a/compat/win32mmap.c\n+++ b/compat/win32mmap.c\n@@ -1,17 +1,5 @@\n #include \"../git-compat-util.h\"\n \n-/*\n- * Note that this doesn't return the actual pagesize, but\n- * the allocation granularity. If future Windows specific git code\n- * needs the real getpagesize function, we need to find another solution.\n- */\n-int mingw_getpagesize(void)\n-{\n-\tSYSTEM_INFO si;\n-\tGetSystemInfo(&si);\n-\treturn si.dwAllocationGranularity;\n-}\n-\n void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)\n {\n \tHANDLE hmap;\n-- \n1.6.5\n"}]}