summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 98a60f6)
raw | patch | inline | side by side (parent: 98a60f6)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 22 May 2007 20:44:57 +0000 (20:44 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 22 May 2007 20:44:57 +0000 (20:44 +0000) |
* fix inclusion of fcntl.h
* clenups for configure.ac -- Bernhard Fischer rep dot nop gmail com
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1070 a5681a0c-68f1-0310-ab6d-d61299d08faa
* clenups for configure.ac -- Bernhard Fischer rep dot nop gmail com
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1070 a5681a0c-68f1-0310-ab6d-d61299d08faa
configure.ac | patch | blob | history | |
src/rrd_tool.c | patch | blob | history | |
src/rrd_tool.h | patch | blob | history | |
src/rrd_update.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index 30787101d6d9a7de3db529bf642efe833e0cf847..adc8e3b0c42d86363413646e3878db9b09045ad6 100644 (file)
--- a/configure.ac
+++ b/configure.ac
])
AH_BOTTOM([
+/* enable posix_fadvise on linux */
+#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
+#endif
/* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
make sure you are NOT using bcopy, index or rindex in the code */
# endif
#endif
-/* enable posix_fadvise on linux */
-#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
-#define _XOPEN_SOURCE 600
-#include <fcntl.h>
-#endif
-
#ifdef NO_NULL_REALLOC
# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
#else
# define rrd_realloc(a,b) realloc((a), (b))
-#endif
+#endif
#ifdef NEED_MALLOC_MALLOC_H
# include <malloc/malloc.h>
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
-AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h time.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/time.h sys/times.h sys/param.h sys/resource.h float.h)
+AC_CHECK_HEADERS(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 float.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
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)
+AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
+AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
+#include <fcntl.h>])
+AC_CHECK_DECLS(madvise, [], [], [#include <sys/mman.h>])
if test "x$enable_mmap" = xyes; then
case "$host" in
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index eedbf4a9353367199a38a48be62d206540ff8fff..f1eb11618e18b5a4b98dc8b01ddcd0233d675692 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
struct rusage myusage;
struct timeval starttime;
struct timeval currenttime;
- struct timezone tz;
- tz.tz_minuteswest =0;
- tz.tz_dsttime=0;
- gettimeofday(&starttime,&tz);
+ gettimeofday(&starttime, NULL);
#endif
RemoteMode=1;
if ((argc == 3) && strcmp("",argv[2])){
#if HAVE_GETRUSAGE
getrusage(RUSAGE_SELF,&myusage);
- gettimeofday(¤ttime,&tz);
+ gettimeofday(¤ttime,NULL);
printf("OK u:%1.2f s:%1.2f r:%1.2f\n",
(double)myusage.ru_utime.tv_sec+
(double)myusage.ru_utime.tv_usec/1000000.0,
diff --git a/src/rrd_tool.h b/src/rrd_tool.h
index 029126e3935480f53d3fab78c54729eb6f97f105..6663c56e501ae2d6c3af021e063ecc58f6f207ea 100644 (file)
--- a/src/rrd_tool.h
+++ b/src/rrd_tool.h
#ifdef MUST_DISABLE_FPMASK
#include <floatingpoint.h>
#endif
-
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#include <time.h>
#include <ctype.h>
#if HAVE_SYS_PARAM_H
# include <sys/stat.h>
#endif
-
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
-#if HAVE_SYS_TIME_H
+
+#if TIME_WITH_SYS_TIME
# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
#endif
+
#if HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
+
+
#if HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#if (defined(__svr4__) && defined(__sun__))
#else
/* unix-only includes */
-#ifndef isnan
+#if !defined isnan && !defined HAVE_ISNAN
int isnan(double value);
#endif
diff --git a/src/rrd_update.c b/src/rrd_update.c
index 608c3146c39b9ff1f9c4954c9e586c81c6715a21..ed79a6a15b1856b2a153468a8c4b0036ff40a9c0 100644 (file)
--- a/src/rrd_update.c
+++ b/src/rrd_update.c
#include <sys/types.h>
#include <fcntl.h>
#ifdef HAVE_MMAP
- #include <sys/mman.h>
+# include <sys/mman.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
@@ -430,9 +430,9 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
#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);
+ madvise(rrd_mmaped_file,rrd_filesize,POSIX_MADV_RANDOM);
+#endif
#endif
-#endif
/* loop through the arguments. */
for(arg_i=0; arg_i<argc;arg_i++) {
char *stepper = strdup(argv[arg_i]);