summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36b14cd)
raw | patch | inline | side by side (parent: 36b14cd)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 18 May 2007 11:56:34 +0000 (11:56 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 18 May 2007 11:56:34 +0000 (11:56 +0000) |
* in create we have to flush before dropping.
* read fcntl.h after defining the __USE_XOPEN2K
* fix drop code in fetch ...
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1065 a5681a0c-68f1-0310-ab6d-d61299d08faa
* read fcntl.h after defining the __USE_XOPEN2K
* fix drop code in fetch ...
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1065 a5681a0c-68f1-0310-ab6d-d61299d08faa
configure.ac | patch | blob | history | |
src/rrd_create.c | patch | blob | history | |
src/rrd_fetch.c | patch | blob | history | |
src/rrd_update.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index f878dccd3ae5eddeab90b07be6902e4749b8005c..202f370a1994c714f8105907da4a063249c70093 100644 (file)
--- a/configure.ac
+++ b/configure.ac
/* enable posix_fadvise on linux */
#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
-#include <fcntl.h>
#define __USE_XOPEN2K 1
+#include <fcntl.h>
#endif
#ifdef NO_NULL_REALLOC
diff --git a/src/rrd_create.c b/src/rrd_create.c
index 6f4c8043da656128e2adc2be9971c54edf6a8227..e9ac860dca92c184f1012e5617076933b3dcdb99 100644 (file)
--- a/src/rrd_create.c
+++ b/src/rrd_create.c
a single rrd file is not too large, but I assume this should not be the case
in general. Otherwhise we would have to sync and release while writing all
the unknown data. */
+ fflush(rrd_file);
fdatasync(fileno(rrd_file));
if (0 != posix_fadvise(fileno(rrd_file), rrd_head_size, 0, POSIX_FADV_DONTNEED)) {
rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",file_name, rrd_strerror(errno));
diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c
index 0676b4ac3102172a894359e787ffe338574755ff..1b85edb1c602080c256b7ab440afbffeee359ab7 100644 (file)
--- a/src/rrd_fetch.c
+++ b/src/rrd_fetch.c
#ifdef HAVE_POSIX_FADVISE
/* don't pollute the buffer cache with data read from the file. We do this while reading to
keep damage minimal */
- if (0 != posix_fadvise(fileno(in_file), rrd_head_size, ftell(in_file), POSIX_FADV_DONTNEED)) {
+ if (0 != posix_fadvise(fileno(in_file), rrd_head_size, 0, POSIX_FADV_DONTNEED)) {
rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",filename, rrd_strerror(errno));
fclose(in_file);
return(-1);
diff --git a/src/rrd_update.c b/src/rrd_update.c
index 91a1d1bf53f98c82e0a454f4fe22a0f816321dc5..5f27c2f966a66784e50bf5d1a7193f9177d3095e 100644 (file)
--- a/src/rrd_update.c
+++ b/src/rrd_update.c
@@ -1195,7 +1195,7 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
i < rrd.stat_head->rra_cnt;
rra_start += rrd.rra_def[i].row_cnt * rrd.stat_head -> ds_cnt * sizeof(rrd_value_t),
i++) {
- /* is there anything to write for this RRA? If not, continue. */
+ /* is th5Aere anything to write for this RRA? If not, continue. */
if (rra_step_cnt[i] == 0) continue;
/* write the first row */
@@ -1398,7 +1398,8 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
fclose(rrd_file);
return(-1);
}
-#ifdef HAVE_POSIX_FADVISE
+
+#ifdef HAVE_POSIX_FADVISExxx
/* with update we have write ops, so they will probably not be done by now, this means
the buffers will not get freed. But calling this for the whole file - header
@@ -1449,7 +1450,7 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
rra_start += rrd.rra_def[i].row_cnt
*rrd.stat_head->ds_cnt*sizeof(rrd_value_t);
}
-#ifdef HAVE_POSIX_FADVISE
+#ifdef HAVE_POSIX_FADVISExxx
/* same procedure as above ... */
if (0 != posix_fadvise(fileno(rrd_file), rra_begin, 0, POSIX_FADV_DONTNEED)) {
rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",filename, rrd_strerror(errno));