summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 21b3ca8)
raw | patch | inline | side by side (parent: 21b3ca8)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 11 Sep 2007 06:16:52 +0000 (06:16 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 11 Sep 2007 06:16:52 +0000 (06:16 +0000) |
program/configure.ac | patch | blob | history | |
program/src/rrd_open.c | patch | blob | history |
diff --git a/program/configure.ac b/program/configure.ac
index b22a80fecd7d89f63e9bc96a89d175bf93642658..a889daae27f1c563bd06bffa5def6305c27faee7 100644 (file)
--- a/program/configure.ac
+++ b/program/configure.ac
[],
[enable_mmap=yes])
-dnl will most likely not work on compressed filesystems, i think.. *shrug*
-AC_ARG_ENABLE([direct-io],
-[ --enable-direct-io enable O_DIRECT if available],
-[enable_direct_io=yes],
-[])
-
AC_ARG_ENABLE(pthread,[ --disable-pthread disable multithread support],
[],[enable_pthread=yes])
AC_HEADER_DIRENT
AC_CHECK_HEADERS(features.h sys/stat.h sys/types.h fcntl.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h signal.h float.h stdio.h stdlib.h errno.h string.h ctype.h)
-if test "x$enable_direct_io" = "xyes"; then
-AC_CACHE_CHECK([for O_DIRECT flag to open(2)],rrd_cv_HAVE_OPEN_O_DIRECT,[
-AC_TRY_COMPILE([
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif],
-[int fd = open("/dev/null", O_DIRECT);],
-rrd_cv_HAVE_OPEN_O_DIRECT=yes,rrd_cv_HAVE_OPEN_O_DIRECT=no)])
- if test "x$rrd_cv_HAVE_OPEN_O_DIRECT" = "xyes"; then
- AC_DEFINE(USE_DIRECT_IO,1,[Whether the open(2) accepts O_DIRECT])
- else
- enable_direct_io="no"
- fi
-else
- enable_direct_io="no"
-fi
-
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
*)
AC_CHECK_HEADERS(sys/mman.h)
AC_FUNC_MMAP
- AC_CHECK_FUNCS(mmap munmap)
+ AC_CHECK_FUNCS(mmap munmap msync)
AC_CHECK_DECLS(madvise, [], [], [#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif])
echo "Config is DONE!"
echo
echo " With MMAP IO: $enable_mmap"
-echo " Use O_DIRECT: $enable_direct_io"
echo " Static programs: $staticprogs"
echo " Perl Modules: $COMP_PERL"
echo " Perl Binary: $PERL"
diff --git a/program/src/rrd_open.c b/program/src/rrd_open.c
index 4ee68a67f65e17ca0f1d5e2e975f69e186f7dee0..70e0ab9f5d6b38dd3b4339a438943f848e8c25d1 100644 (file)
--- a/program/src/rrd_open.c
+++ b/program/src/rrd_open.c
int ret;
#ifdef HAVE_MMAP
+ ret = msync(rrd_file->file_start, rrd_file->file_len,MS_ASYNC);
+ if (ret != 0)
+ rrd_set_error("msync rrd_file: %s", rrd_strerror(errno));
ret = munmap(rrd_file->file_start, rrd_file->file_len);
if (ret != 0)
rrd_set_error("munmap rrd_file: %s", rrd_strerror(errno));