Commit af9b7fee80c56b28b68b06d4452580ec51066242

Stefan Sperling 2018-07-09T16:32:39

add compile-time switch which disables mmap for pack files

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/lib/pack.c b/lib/pack.c
index c285d19..856b660 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -584,10 +584,12 @@ cache_pack(struct got_pack **packp, const char *path_packfile,
 	if (err)
 		goto done;
 
+#ifndef GOT_PACK_NO_MMAP
 	pack->map = mmap(NULL, pack->filesize, PROT_READ, MAP_PRIVATE,
 	    pack->fd, 0);
 	if (pack->map == MAP_FAILED)
 		pack->map = NULL; /* fall back to read(2) */
+#endif
 done:
 	if (err) {
 		if (pack) {