From: Charles Davis cdavis5x@gmail.com
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/ntdll/unix/file.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 4286b81aa1f..ea3c947da73 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -142,6 +142,20 @@ static int posix_fallocate( int fd, off_t offset, off_t len ) if (fallocate( fd, 0, offset, len ) < 0) return errno; return 0; +#elif defined(F_PREALLOCATE) + struct fstore fst; + struct stat st; + + if (fstat( fd, &st ) < 0) + return errno; + + fst.fst_flags = F_ALLOCATECONTIG|F_ALLOCATEALL; + fst.fst_posmode = F_PEOFPOSMODE; + fst.fst_offset = 0; + fst.fst_length = len + offset - st.st_blocks * 512; + if (fcntl( fd, F_PREALLOCATE, &fst ) < 0) + return errno; + return 0; #else return ENOSYS; #endif