Compilation problem with linux/falloc.h include in rsync.h

Mulander netprobe at
Sun May 15 10:19:44 MDT 2011

Hi all,
I'm trying to compile rsync from the git sources (rev
8bcd6a4afff3cb8197d5589ec4fdf9fe153f53de) the configuration step went
without any reported problems so I ran the make utility to compile the code

The following error was almost immediately returned after running make:

./rsync.h:669:26: fatal error: linux/falloc.h: No such file or directory

The reported line resides in rsync.h and includes the falloc.h header file
if HAVE_FALLOCATE or HAVE_SYS_FALLOCATE is defined by the configuration

#include <linux/falloc.h>

The generated config.h file (created by ./configure) contains a definition
of HAVE_FALLOCATE (initialized to 1) and HAVE_POSIX_FALLOCATE.
HAVE_SYS_FALLOCATE remains undefined.

I double checked the config.log to see why the configuration step passed and
the final compilation failed.

Here is the code extracted from to check the availability of

#include <fcntl.h>
#include <sys/types.h>
main ()
fallocate(0, 0, 0, 0);
  return 0;

This code compiles (with a warning) and runs on my system:

mulander at bunkier_mysli:~/code/blog/lac$ gcc -std=gnu99 -o conftest -g -O2
-DHAVE_CONFIG_H -Wall -W test.c

test.c: In function 'main':
test.c:6:3: warning: implicit declaration of function 'fallocate'
mulander at bunkier_mysli:~/code/blog/lac$ ./conftest
mulander at bunkier_mysli:~/code/blog/lac$ echo $?

Adding an include to linux/falloc.h of course results in a failing

I checked the man 2 fallocate page for my system and the synopsis sections
provides the following:

       #define _GNU_SOURCE             /* See feature_test_macros(7) */
       #include <fcntl.h>

       int fallocate(int fd, int mode, off_t offset, off_t len);

Adding the #define _GNU_SOURCE preprocessor directive removes the
compilation warning - the code still passes.

I tracked down the change that introduced the problematic include and it can
be found on the on-line gitweb repository browser:;a=commitdiff;h=28b519c93b6db30b6520d46f8cd65160213fddd2

Since the change is quite fresh (2011-04-05) I was thinking that this is a
possible configuration/conditional compilation problem. I'm just starting to
learn the rsync code base and I am not sure how this issue should be
correctly handled hence my email to this mailing list in the hope that
people more experienced with the code base could make appropriate steps to
resolve it.

Adam Wolk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rsync mailing list