5 #include "../git-compat-util.h"
7 void *gitfakemmap(void *start
, size_t length
, int prot
, int flags
, int fd
, off_t offset
)
10 off_t current_offset
= lseek(fd
, 0, SEEK_CUR
);
12 if (start
!= NULL
|| !(flags
& MAP_PRIVATE
))
13 die("Invalid usage of gitfakemmap.");
15 if (lseek(fd
, offset
, SEEK_SET
) < 0) {
20 start
= xmalloc(length
);
27 int count
= read(fd
, start
+n
, length
-n
);
30 memset(start
+n
, 0, length
-n
);
43 if (current_offset
!= lseek(fd
, current_offset
, SEEK_SET
)) {
51 int gitfakemunmap(void *start
, size_t length
)