From b2740577e4d006acbe29061cf39bd00afb7b377f Mon Sep 17 00:00:00 2001 From: Keith Rarick Date: Wed, 13 May 2009 01:13:08 -0700 Subject: [PATCH] Step one for preallocation on several platforms. --- binlog.c | 6 ++++++ configure.in | 2 ++ 2 files changed, 8 insertions(+) diff --git a/binlog.c b/binlog.c index afec207..e325414 100644 --- a/binlog.c +++ b/binlog.c @@ -34,6 +34,7 @@ #include "job.h" #include "binlog.h" #include "util.h" +#include "config.h" /* max size we will create a log file */ size_t binlog_size_limit = 10 << 20; @@ -285,7 +286,12 @@ binlog_open(binlog log) if (fd < 0) return twarn("Cannot open binlog %s", log->path), -1; +#ifdef HAVE_POSIX_FALLOCATE r = posix_fallocate(fd, 0, binlog_size_limit); +#else + #warning no known method to preallocate files on this platform + r = 0; +#endif if (r) { close(fd); binlog_dref(log); diff --git a/configure.in b/configure.in index f011f48..3bc2495 100644 --- a/configure.in +++ b/configure.in @@ -100,6 +100,8 @@ else CFLAGS="$CFLAGS -I$LIBEVENT_DIR/include" LIBS="$LIBS -levent" + AC_CHECK_FUNCS([posix_fallocate]) + AC_CHECK_LIB([socket], [bind], [ LIBS="$LIBS -lsocket" ]) -- 2.11.4.GIT