Skip to content

Commit

Permalink
core-shim: add emulation for posix_fallocation if it is not available
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
ColinIanKing committed Jul 28, 2023
1 parent 4156d5d commit c3b3fb8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core-shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ static int shim_emulate_fallocate(int fd, off_t offset, off_t len)
*/
int shim_posix_fallocate(int fd, off_t offset, off_t len)
{
#if defined(HAVE_POSIX_FALLOCATE)
int ret;
const off_t chunk_len = (off_t)(1 * MB);

Expand All @@ -283,6 +284,9 @@ int shim_posix_fallocate(int fd, off_t offset, off_t len)
} while (len > 0);

return 0;
#else
return shim_emulate_fallocate(fd, offset, len);
#endif
}


Expand Down

0 comments on commit c3b3fb8

Please sign in to comment.