1 #include "../git-compat-util.h"
3 void *gitfakemmap(void *start
, size_t length
, int prot
, int flags
, int fd
, off_t offset
)
6 off_t current_offset
= lseek(fd
, 0, SEEK_CUR
);
8 if (start
!= NULL
|| !(flags
& MAP_PRIVATE
))
9 die("Invalid usage of gitfakemmap.");
11 if (lseek(fd
, offset
, SEEK_SET
) < 0) {
16 start
= xmalloc(length
);
23 int count
= read(fd
, start
+n
, length
-n
);
26 memset(start
+n
, 0, length
-n
);
39 if (current_offset
!= lseek(fd
, current_offset
, SEEK_SET
)) {
47 int gitfakemunmap(void *start
, size_t length
)