changeset 7164:d349cdeddc7d HEAD

Don't use posix_fallocate() with GLIBC versions older than 2.7. It probably works with a bit older versions, but at least in 2.3.5 it can cause infinite loops.
author Timo Sirainen <tss@iki.fi>
date Wed, 16 Jan 2008 18:24:09 +0200
parents b7fc50c68c35
children 805d0831deb6
files configure.in
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Tue Jan 15 18:16:06 2008 +0200
+++ b/configure.in	Wed Jan 16 18:24:09 2008 +0200
@@ -431,7 +431,7 @@
 	       setrlimit setproctitle seteuid setreuid setegid setresgid \
 	       strtoull strtouq setpriority quotactl getmntent kqueue kevent \
 	       backtrace_symbols walkcontext dirfd \
-	       malloc_usable_size posix_fallocate)
+	       malloc_usable_size)
 
 dnl * I/O loop function
 have_ioloop=no
@@ -596,6 +596,19 @@
   AC_DEFINE(PREAD_WRAPPERS,, Define if pread/pwrite needs _XOPEN_SOURCE 500)
 ])
 
+dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
+AC_TRY_COMPILE([
+  #define _XOPEN_SOURCE 600
+  #include <stdlib.h>
+  #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7)
+    possibly broken posix_fallocate
+  #endif
+], [
+  posix_fallocate(0, 0, 0);
+], [
+  AC_DEFINE(HAVE_POSIX_FALLOCATE,, Define if you have a working posix_fallocate())
+])
+
 dnl * OS specific options
 case "$host_os" in
 	hpux*)