From: Tobias Oetiker Date: Wed, 14 May 2014 14:23:32 +0000 (+0200) Subject: make file locking compiletime configurable X-Git-Tag: v1.5.0-rc1~103^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0033ee5df136e333e8601384b21fea611115abac;p=thirdparty%2Frrdtool-1.x.git make file locking compiletime configurable --- diff --git a/configure.ac b/configure.ac index 5fbcfb19..ce2e6604 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ AC_PREREQ(2.59) dnl the official version number is dnl a.b.c -AC_INIT([rrdtool],[1.4.999]) +AC_INIT([rrdtool],m4_esyscmd([tr -d '\n' < VERSION])) dnl for testing a numberical version number comes handy dnl the released version are @@ -131,6 +131,14 @@ AS_HELP_STRING([--disable-mmap],[disable mmap in rrd_update, use seek+write inst AC_ARG_ENABLE(pthread,AS_HELP_STRING([--disable-pthread],[disable multithread support]), [],[enable_pthread=yes]) +AC_ARG_ENABLE([flock], +AS_HELP_STRING([--disable-flock],[disable file locking]), +[], +[enable_flock=yes]) +if test x$enable_file != xyes; then + AC_DEFINE([DISABLE_FLOCK], [], [disable flock calls in rrdtool]) +fi + AC_ARG_ENABLE(static-programs, AS_HELP_STRING([--enable-static-programs],[Build static programs]), [case "${enableval}" in @@ -964,6 +972,7 @@ echo "----------------------------------------------------------------" echo "Config is DONE!" echo echo " With MMAP IO: $enable_mmap" +echo " With Locking: $enable_flock" echo " Build rrd_getopt: $build_getopt" echo " Build rrd_graph: $enable_rrd_graph" echo " Static programs: $staticprogs" diff --git a/src/rrd_open.c b/src/rrd_open.c index 8d055a32..4f011a26 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -500,7 +500,9 @@ int rrd_lock( int rcstat; rrd_simple_file_t *rrd_simple_file; rrd_simple_file = (rrd_simple_file_t *)rrd_file->pvt; - +#ifdef DISABLE_FLOCK + return 0; +#else { #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) struct _stat st; @@ -523,6 +525,7 @@ int rrd_lock( } return (rcstat); +#endif }