diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2005-10-08 15:54:36 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-10-08 15:54:36 -0700 |
commit | 730d48a2ef88a7fb7aa4409d40b1e6964a93267f (patch) | |
tree | 4dda7a024e31f618f849df65f142f1e30fe617a5 /cache.h | |
parent | d119e3de13ea1493107bd57381d0ce9c9dd90976 (diff) | |
download | git-730d48a2ef88a7fb7aa4409d40b1e6964a93267f.tar.gz |
[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.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 */ |