diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-05-13 02:41:48 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-05-17 01:39:43 +0200 |
commit | f7310540ae888454f9ab69200cfcd8df07faf957 (patch) | |
tree | 5f44f5b95c7191c1319846a8ef3534f352f8a98d /src/unix | |
parent | adebcb1645f7bd652ff4449ecf41c39ded12d0c7 (diff) | |
download | libgit2-f7310540ae888454f9ab69200cfcd8df07faf957.tar.gz |
indexer: use mmap for writing
Some OSs cannot keep their ideas about file content straight when mixing
standard IO with file mapping. As we use mmap for reading from the
packfile, let's make writing to the pack file use mmap.
Diffstat (limited to 'src/unix')
-rw-r--r-- | src/unix/map.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/unix/map.c b/src/unix/map.c index e62ab3e76..3d0cbbaf8 100644 --- a/src/unix/map.c +++ b/src/unix/map.c @@ -10,8 +10,14 @@ #include "map.h" #include <sys/mman.h> +#include <unistd.h> #include <errno.h> +long git__page_size(void) +{ + return sysconf(_SC_PAGE_SIZE); +} + int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset) { int mprot = 0; |