diff options
| author | Etienne Samson <samson.etienne@gmail.com> | 2019-01-30 02:14:11 +0100 |
|---|---|---|
| committer | Etienne Samson <samson.etienne@gmail.com> | 2019-01-30 02:14:11 +0100 |
| commit | 4e3949b73e2dfcc0dfe29c1f39c813769772d44f (patch) | |
| tree | eb15d778f69f21a0ecf4d5121b48b2a42f9ef1c2 /src/posix.c | |
| parent | cf14215deda8fa8ec0da7567e15f0acb8035d162 (diff) | |
| download | libgit2-4e3949b73e2dfcc0dfe29c1f39c813769772d44f.tar.gz | |
tests: test that largefiles can be read through the tree API
Diffstat (limited to 'src/posix.c')
| -rw-r--r-- | src/posix.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/posix.c b/src/posix.c index bffe02e05..ef48c6012 100644 --- a/src/posix.c +++ b/src/posix.c @@ -216,6 +216,23 @@ int p_write(git_file fd, const void *buf, size_t cnt) return 0; } +int p_fallocate(int fd, off_t offset, off_t len) +{ +#ifdef __APPLE__ + fstore_t prealloc; + + memset(&prealloc, 0, sizeof(prealloc)); + prealloc.fst_flags = F_ALLOCATEALL; + prealloc.fst_posmode = F_PEOFPOSMODE; + prealloc.fst_offset = offset; + prealloc.fst_length = len; + + return fcntl(fd, F_PREALLOCATE, &prealloc); +#else + return posix_fallocate(fd, offset, len); +#endif +} + #ifdef NO_MMAP #include "map.h" |
