From: oetiker Date: Fri, 1 Jun 2007 09:10:33 +0000 (+0000) Subject: Bernhard Fischer X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=commitdiff_plain;h=58a8f90229ee1625e0270256683b048da1b1df24 Bernhard Fischer - use 'z' length modifier when printing size_t - add a cast to __rrd_read and document why it is there - add RANDOM hint for the header git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1096 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c index 23567c5..75dabf4 100644 --- a/src/rrd_cgi.c +++ b/src/rrd_cgi.c @@ -494,7 +494,7 @@ int main( if (!filter) { printf("Content-Type: text/html\n" - "Content-Length: %d\n", strlen(buffer)); + "Content-Length: %zd\n", strlen(buffer)); if (labs(goodfor) > 0) { time_t now; diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 0c1c7d8..2ea3a2d 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -1029,7 +1029,7 @@ void rrd_graph_script( break; } if (gdp->debug) { - dprintf("used %i out of %i chars\n", eaten, strlen(argv[i])); + dprintf("used %i out of %zi chars\n", eaten, strlen(argv[i])); dprintf("parsed line: '%s'\n", argv[i]); dprintf("remaining: '%s'\n", &argv[i][eaten]); if (eaten >= strlen(argv[i])) diff --git a/src/rrd_open.c b/src/rrd_open.c index 525fa29..746044e 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -76,8 +76,11 @@ #define CHECK_MADVISE_OVERLAPS 1 #ifdef HAVE_MMAP +/* the cast to void* is there to avoid this warning seen on ia64 with certain + versions of gcc: 'cast increases required alignment of target type' +*/ #define __rrd_read(dst, dst_t, cnt) \ - (dst) = (dst_t*) (data + offset); \ + (dst) = (dst_t*)(void*) (data + offset); \ offset += sizeof(dst_t) * (cnt) #else #define __rrd_read(dst, dst_t, cnt) \ @@ -246,24 +249,22 @@ rrd_file_t *rrd_open( _madvise(data, rrd_file->file_len, MADV_WILLNEED | MADV_SEQUENTIAL); goto out_done; } +# ifndef ONE_PAGE /* We do not need to read anything in for the moment */ -#ifndef ONE_PAGE _madvise(data, rrd_file->file_len, MADV_DONTNEED); -// _madvise(data, rrd_file->file_len, MADV_RANDOM); -#else -/* alternatively: keep 2 pages worth of data, likely headers, +# else +/* alternatively: keep 1 page worth of data, likely headers, * don't need the rest. */ _madvise(data, _page_size, MADV_WILLNEED | MADV_SEQUENTIAL); _madvise(data + _page_size, (rrd_file->file_len >= _page_size) ? rrd_file->file_len - _page_size : 0, MADV_DONTNEED); -#endif +# endif #endif #if defined USE_MADVISE && !defined ONE_PAGE /* the stat_head will be needed soonish, so hint accordingly */ -// too finegrained to calc the individual sizes, just keep 2 pages worth of hdr _madvise(data + PAGE_ALIGN_DOWN(offset), PAGE_ALIGN(sizeof(stat_head_t)), - MADV_WILLNEED); + MADV_WILLNEED | MADV_RANDOM); #endif