From 3553a830bfc6958cde565c9ffcb809b3cf3779ff Mon Sep 17 00:00:00 2001 From: oetiker Date: Fri, 18 May 2007 16:40:55 +0000 Subject: [PATCH] added madvise MADV_RANDOM is rrd_update uses mmap git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1066 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/configure.ac | 2 +- program/src/rrd_update.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/program/configure.ac b/program/configure.ac index 202f370a..df219553 100644 --- a/program/configure.ac +++ b/program/configure.ac @@ -248,7 +248,7 @@ AC_C_BIGENDIAN dnl for each function found we get a definition in config.h dnl of the form HAVE_FUNCTION -AC_CHECK_FUNCS(tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday posix_fadvise) +AC_CHECK_FUNCS(tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday posix_fadvise madvise) if test "x$enable_mmap" = xyes; then diff --git a/program/src/rrd_update.c b/program/src/rrd_update.c index 5f27c2f9..608c3146 100644 --- a/program/src/rrd_update.c +++ b/program/src/rrd_update.c @@ -427,7 +427,12 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv fclose(rrd_file); return(-1); } +#ifdef HAVE_MADVISE + /* when we use mmaping we tell the kernel the mmap equivalent + of POSIX_FADV_RANDOM */ + madvise(rrd_mmaped_file,rrd_filesize,MADV_RANDOM); #endif +#endif /* loop through the arguments. */ for(arg_i=0; arg_i