aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2005-10-08 15:54:36 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-08 15:54:36 -0700
commit730d48a2ef88a7fb7aa4409d40b1e6964a93267f (patch)
tree4dda7a024e31f618f849df65f142f1e30fe617a5 /cache.h
parentd119e3de13ea1493107bd57381d0ce9c9dd90976 (diff)
downloadgit-730d48a2ef88a7fb7aa4409d40b1e6964a93267f.tar.gz
git-730d48a2ef88a7fb7aa4409d40b1e6964a93267f.tar.xz
[PATCH] If NO_MMAP is defined, fake mmap() and munmap()
Since some platforms do not support mmap() at all, and others do only just so, this patch introduces the option to fake mmap() and munmap() by malloc()ing and read()ing explicitely. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 514adb8f8..5987d4c12 100644
--- a/cache.h
+++ b/cache.h
@@ -11,7 +11,9 @@
#include <string.h>
#include <errno.h>
#include <limits.h>
+#ifndef NO_MMAP
#include <sys/mman.h>
+#endif
#include <sys/param.h>
#include <netinet/in.h>
#include <sys/types.h>
@@ -356,4 +358,18 @@ extern void packed_object_info_detail(struct pack_entry *, char *, unsigned long
/* Dumb servers support */
extern int update_server_info(int);
+#ifdef NO_MMAP
+
+#ifndef PROT_READ
+#define PROT_READ 1
+#define PROT_WRITE 2
+#define MAP_PRIVATE 1
+#define MAP_FAILED ((void*)-1)
+#endif
+
+extern void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset);
+extern int gitfakemunmap(void *start, size_t length);
+
+#endif
+
#endif /* CACHE_H */