From: Wade Cline Date: Wed, 1 Aug 2012 06:45:48 +0000 (+0200) Subject: Fix fallocate erroneously returning ENOSYS on Linux systems X-Git-Tag: fio-2.0.9~12 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=bcb01f840c244851f760e5ea3bb0fe9aa1c03188;ds=sidebyside Fix fallocate erroneously returning ENOSYS on Linux systems Currently, the helpers.c file provides a function defintion for Linux fallocate that sets errno to ENOSYS and returns failure; this is useful for a non-Linux OS. However, this definition will override the Linux implementation of fallocate when 'fallocate=keep' is set. Adding a preprocessor macro to check if Linux fallocate is defined fixes this issue. Signed-off-by: Wade Cline Signed-off-by: Jens Axboe --- diff --git a/helpers.c b/helpers.c index 95625672..5be45ccf 100644 --- a/helpers.c +++ b/helpers.c @@ -9,11 +9,13 @@ #include "arch/arch.h" #include "os/os.h" +#ifndef FIO_HAVE_LINUX_FALLOCATE int _weak fallocate(int fd, int mode, off_t offset, off_t len) { errno = ENOSYS; return -1; } +#endif #ifndef __NR_fallocate int _weak posix_fallocate(int fd, off_t offset, off_t len)