1 #include "../git-compat-util.h"
3 void *git_mmap(void *start
, size_t length
, int prot
, int flags
, int fd
, off_t offset
)
7 if (start
!= NULL
|| !(flags
& MAP_PRIVATE
))
8 die("Invalid usage of mmap when built with NO_MMAP");
10 start
= xmalloc(length
);
17 ssize_t count
= pread(fd
, (char *)start
+ n
, length
- n
, offset
+ n
);
20 memset((char *)start
+n
, 0, length
-n
);
25 if (errno
== EAGAIN
|| errno
== EINTR
)
38 int git_munmap(void *start
, size_t length
)