* will be changed to represent reality */
unsigned long *ds_cnt, /* number of data sources in file */
char ***ds_namv, /* names of data sources */
* will be changed to represent reality */
unsigned long *ds_cnt, /* number of data sources in file */
char ***ds_namv, /* names of data sources */
cf = argv[optind + 1];
if (rrd_fetch_r(argv[optind], cf, start, end, step, ds_cnt, ds_namv, data)
cf = argv[optind + 1];
if (rrd_fetch_r(argv[optind], cf, start, end, step, ds_cnt, ds_namv, data)
* will be changed to represent reality */
unsigned long *ds_cnt, /* number of data sources in file */
char ***ds_namv, /* names of data_sources */
* will be changed to represent reality */
unsigned long *ds_cnt, /* number of data sources in file */
char ***ds_namv, /* names of data_sources */
* will be changed to represent reality */
unsigned long *ds_cnt, /* number of data sources in file */
char ***ds_namv, /* names of data_sources */
* will be changed to represent reality */
unsigned long *ds_cnt, /* number of data sources in file */
char ***ds_namv, /* names of data_sources */
{ /* two dimensional array containing the data */
long i, ii;
time_t cal_start, cal_end, rra_start_time, rra_end_time;
{ /* two dimensional array containing the data */
long i, ii;
time_t cal_start, cal_end, rra_start_time, rra_end_time;
#ifdef DEBUG
fprintf(stderr, "Entered rrd_fetch_fn() searching for the best match\n");
fprintf(stderr, "Looking for: start %10lu end %10lu step %5lu\n",
#ifdef DEBUG
fprintf(stderr, "Entered rrd_fetch_fn() searching for the best match\n");
fprintf(stderr, "Looking for: start %10lu end %10lu step %5lu\n",
/* when was the really last update of this file ? */
if (((*ds_namv) =
(char **) malloc(rrd.stat_head->ds_cnt * sizeof(char *))) == NULL) {
rrd_set_error("malloc fetch ds_namv array");
/* when was the really last update of this file ? */
if (((*ds_namv) =
(char **) malloc(rrd.stat_head->ds_cnt * sizeof(char *))) == NULL) {
rrd_set_error("malloc fetch ds_namv array");
}
for (i = 0; (unsigned long) i < rrd.stat_head->ds_cnt; i++) {
if ((((*ds_namv)[i]) = malloc(sizeof(char) * DS_NAM_SIZE)) == NULL) {
rrd_set_error("malloc fetch ds_namv entry");
}
for (i = 0; (unsigned long) i < rrd.stat_head->ds_cnt; i++) {
if ((((*ds_namv)[i]) = malloc(sizeof(char) * DS_NAM_SIZE)) == NULL) {
rrd_set_error("malloc fetch ds_namv entry");
}
strncpy((*ds_namv)[i], rrd.ds_def[i].ds_nam, DS_NAM_SIZE - 1);
(*ds_namv)[i][DS_NAM_SIZE - 1] = '\0';
}
strncpy((*ds_namv)[i], rrd.ds_def[i].ds_nam, DS_NAM_SIZE - 1);
(*ds_namv)[i][DS_NAM_SIZE - 1] = '\0';
*ds_cnt = rrd.stat_head->ds_cnt;
if (((*data) = malloc(*ds_cnt * rows * sizeof(rrd_value_t))) == NULL) {
rrd_set_error("malloc fetch data area");
*ds_cnt = rrd.stat_head->ds_cnt;
if (((*data) = malloc(*ds_cnt * rows * sizeof(rrd_value_t))) == NULL) {
rrd_set_error("malloc fetch data area");
- if (rrd_seek(rrd_file, (rra_base
- + (rra_pointer
- * *ds_cnt
- * sizeof(rrd_value_t))), SEEK_SET) != 0) {
+ if (rrd_seek(rrd_file, (rra_base + (rra_pointer * (*ds_cnt)
+ * sizeof(rrd_value_t))),
+ SEEK_SET) != 0) {
* be wrapped*/
if (rra_pointer >= (signed) rrd.rra_def[chosen_rra].row_cnt) {
rra_pointer -= rrd.rra_def[chosen_rra].row_cnt;
* be wrapped*/
if (rra_pointer >= (signed) rrd.rra_def[chosen_rra].row_cnt) {
rra_pointer -= rrd.rra_def[chosen_rra].row_cnt;
}
#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 !=
}
#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(rrd_file->fd, rrd_head_size, 0,
+ posix_fadvise(rrd_file->fd, rrd_file->header_len, 0,
POSIX_FADV_DONTNEED)) {
rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",
filename, rrd_strerror(errno));
POSIX_FADV_DONTNEED)) {
rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",
filename, rrd_strerror(errno));
- posix_fadvise(rrd_file->fd, rrd_head_size, 0, POSIX_FADV_DONTNEED)) {
+ posix_fadvise(rrd_file->fd, rrd_file->header_len, 0,
+ POSIX_FADV_DONTNEED)) {