diff -ur transmission-2.30b1.orig/configure.ac transmission-2.30b1/configure.ac --- transmission-2.30b1.orig/configure.ac 2011-04-01 03:28:41.000000000 +0200 +++ transmission-2.30b1/configure.ac 2011-04-08 14:31:31.233502737 +0200 @@ -108,6 +108,14 @@ AC_HEADER_STDC AC_HEADER_TIME +AC_MSG_CHECKING([for SYS_fallocate]) +AC_TRY_LINK([#include +#include ], + [return syscall(SYS_fallocate, 0, 0, (loff_t) 0, (loff_t) 0);], + [AC_DEFINE([HAVE_SYS_FALLOCATE],[1],[Defined if you have the SYS_fallocate syscall number]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + AC_CHECK_HEADERS([stdbool.h]) AC_CHECK_FUNCS([iconv_open pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll]) AC_PROG_INSTALL diff -ur transmission-2.30b1.orig/libtransmission/fdlimit.c transmission-2.30b1/libtransmission/fdlimit.c --- transmission-2.30b1.orig/libtransmission/fdlimit.c 2011-04-01 03:28:34.000000000 +0200 +++ transmission-2.30b1/libtransmission/fdlimit.c 2011-04-08 14:34:14.120502738 +0200 @@ -29,6 +29,10 @@ #include #endif +#ifdef HAVE_SYS_FALLOCATE + #include +#endif + #ifdef HAVE_FALLOCATE64 /* FIXME can't find the right #include voodoo to pick up the declaration.. */ extern int fallocate64( int fd, int mode, uint64_t offset, uint64_t len ); @@ -150,6 +154,14 @@ success = !fcntl( fd, F_PREALLOCATE, &fst ); } # endif + +# ifdef HAVE_SYS_FALLOCATE + if( !success ) + { + success = !syscall( SYS_fallocate, fd, 0, (loff_t) 0, (loff_t) length ); + } +# endif + # ifdef HAVE_POSIX_FALLOCATE if( !success ) {