Wolfgang Stöggl [Sat, 14 Jul 2018 12:31:06 +0000 (14:31 +0200)]
Fix lastupdate time in dump (32bit MSVC only)
- So far, (null) was written into the lastupdate time string:
e.g.: <lastupdate>1511170870</lastupdate> <!-- (null) -->
- The problem occurred only in 32bit MSVC builds
- Works for both, with or without _USE_32BIT_TIME_T
bindings: python: Fix race conditions at arguments access
rrdtool_argv and rrdtool_argc have to be allocated at each function stack in
order to have copy of variables for each running thread. Note that we call
librrd functions with GIL unlocked, so previously there was simultaneous access
to global rrdtool_argv and rrdtool_argc variables.
Fixes: 8949308812a0 ("Unlock the global thread lock while processing rrd") Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Wolfgang Stöggl [Tue, 2 Jan 2018 10:04:40 +0000 (11:04 +0100)]
Fix expansion-to-defined warnings (GCC 7)
- Fixed compiler warnings:
gettext.h:176:6: warning: this use of "defined" may not be portable
[-Wexpansion-to-defined] #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
gettext.h:200:5: warning: this use of "defined" may not be portable
[-Wexpansion-to-defined] #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
gettext.h:215:6: warning: this use of "defined" may not be portable
[-Wexpansion-to-defined] #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
gettext.h:246:5: warning: this use of "defined" may not be portable
[-Wexpansion-to-defined] #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
gettext.h:261:6: warning: this use of "defined" may not be portable
[-Wexpansion-to-defined] #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
Wolfgang Stöggl [Sun, 31 Dec 2017 13:38:29 +0000 (14:38 +0100)]
Fix 64-bit time_t in fprintf, printf (MSVC)
- In VS2005 and later, the default size for time_t is 64-bit, unless
_USE_32BIT_TIME_T has been defined to use a 32-bit time_t ...
- Fixes MSVC compiler warnings:
./src\rrd_graph_helper.c(1465): warning C4477: 'fprintf' :
format string '%li' requires an argument of type 'long',
but variadic argument 1 has type 'time_t'
./src\rrd_lastupdate.c(83): warning C4477: 'printf' :
format string '%10lu' requires an argument of type 'unsigned long',
but variadic argument 1 has type 'time_t'
./src\rrd_tool.c(720): warning C4477: 'printf' : format string '%ld'
requires an argument of type 'long', but variadic argument 1 has type
'time_t'
./src\rrd_tool.c(724): warning C4477: 'printf' : format string '%ld'
requires an argument of type 'long', but variadic argument 1 has type
'time_t'
./src\rrd_tool.c(742): warning C4477: 'printf' : format string
'%10lu' requires an argument of type 'unsigned long', but variadic
argument 1 has type 'time_t'
Wolfgang Stöggl [Tue, 26 Dec 2017 05:57:53 +0000 (06:57 +0100)]
Check for MinGW-w64 build, add win32-glob files
- configure.ac: Add check for MinWG-w64 build during configure.
Pass the conditional MINGW_W64 to automake
- src/Makefile.am: Add win32-glob.c to RRD_C_FILES and
win32-glob.h to noinst_HEADERS in case of MINGW_W64
- Enables out of the box configure and make for MinGW-w64 builds
Wolfgang Stöggl [Thu, 14 Dec 2017 20:10:11 +0000 (21:10 +0100)]
Fix compiler warnings, llu lli 64bit (MinGW-w64)
- time_t is of type 'long long int', when compiled for 64 bit Windows
(x86_64-w64-mingw32). Use %10llu instead of %10lu in printf and
%lli instead of %li in dprintf. Requires __USE_MINGW_ANSI_STDIO 1
- Fixes: rrd_lastupdate.c: In function 'rrd_lastupdate':
rrd_lastupdate.c:76:18:
warning: format '%lu' expects argument of type 'long unsigned int',
but argument 2 has type 'time_t {aka long long int}' [-Wformat=]
- Fixes: rrd_graph_helper.c: In function 'parse_shift':
rrd_graph_helper.c:1458:13:
warning: format '%li' expects argument of type 'long int',
but argument 3 has type 'time_t {aka long long int}' [-Wformat=]
dprintf("SHIFTBY : %li\n",gdp->shval);
Wolfgang Stöggl [Thu, 7 Dec 2017 20:43:53 +0000 (21:43 +0100)]
Fix ctime_r configure error (MinGW-w64)
- configure.ac: include pthread.h inside AC_LANG_PROGRAM
for ctime_r check if __MINGW32__ is defined
Fixes:
checking if ctime_r need special care to act posixly correct...
configure: error: Can't figure how to compile ctime_r
Wolfgang Stöggl [Wed, 6 Dec 2017 10:55:04 +0000 (11:55 +0100)]
Fix further build errors (MinGW-w64)
- rrd_list.c: MinGW-w64 does not provide glob.h (yet?)
include win32/win32-glob.h using HAVE_GLOB_H. Fixes:
rrd_list.c:9:10: fatal error: glob.h: No such file or directory
#include <glob.h>
- rrd_update.c: MinGW has gettimeofday() in time.h. Fixes:
rrd_update.c:46:12: error: conflicting types for 'gettimeofday'
static int gettimeofday(
- rrd_tool.c: MinGW has not got getuid and mkdir only one argument.
Fixes:
rrd_tool.c:585:17: warning: nested extern declaration of 'getuid'
rrd_tool.c:632:16: error: too many arguments to function 'mkdir'
if(mkdir(argv[2], 0777)!=0){
- rrd_tool.h:
MinGW-w64 provides localtime_r, ctime_r, gmtime_r, strtok_r
- rrd_graph.c: MinGW has strftime and tzname.
Due to the resulting later include of time.h, fixes also:
rrd_graph.c:1558: undefined reference to `localtime_r'
- rrd_client.c: MinGW does not provide realpath, "is_unix" excluded.
Fixes:
rrd_client.c:113: undefined reference to `realpath'
rrd_client.c:130: undefined reference to `realpath'
- rrd_rpncalc.c: include pthread.h. Fixes e.g.:
rrd_rpncalc.c:708: undefined reference to `localtime_r'
Wolfgang Stöggl [Thu, 30 Nov 2017 07:55:16 +0000 (08:55 +0100)]
Use #ifdef instead of #if for HAVE_... (#846)
- Harmonizes usage of #ifdef also for:
HAVE_STRFTIME, HAVE_STDARG_H, HAVE_GETRUSAGE
- Fixes compiler warnings like:
rrd_tool.c:468:5: warning: "HAVE_GETRUSAGE" is not defined,
evaluates to 0 [-Wundef]
Wolfgang Stöggl [Tue, 28 Nov 2017 08:18:55 +0000 (09:18 +0100)]
Remove fdatasync, fsync from rrd_config_bottom.h
- fdatasync() has been removed since RRDtool v1.4.0.
See commit: fc968dd
- fixes "Can't compile with without fsync and fdatasync" error
on systems, where HAVE_FDATASYNC or HAVE_FSYNC are not defined
- Solution configuration Debug|Win32: Changed MultiThreadedDebug to
MultiThreadedDebugDLL in rrdtool.vcxproj and rrdupdate.vcxproj.
Now the RuntimeLibrary setting is the same as in librrd-4.vcxproj.
- Solution configuration Static Debug|Win32: Added double quotes around
$(TargetDir), because there is a space in "Static Debug". Fixes
failing copy commands of dlls by using "$(TargetDir)" now.
Wolfgang Stöggl [Wed, 11 Oct 2017 19:47:22 +0000 (21:47 +0200)]
Define HAVE_UINTPTR_T in rrd_config.h for Windows
- Fixes compilation error, when building for x64 under Windows (MSVC):
./src\rrd_snprintf.c(901): warning C4311: 'type cast':
pointer truncation from 'const char *' to 'unsigned long'
- uintptr_t is a defined standard type in Visual Studio:
https://msdn.microsoft.com/en-us/library/323b6b3k.aspx
Wolfgang Stöggl [Tue, 10 Oct 2017 20:58:12 +0000 (22:58 +0200)]
Use pcre from Win-builds, enables x64 builds (#833)
- Switch to newer version of pcre from Win-builds
http://win-builds.org/next/packages/windows_32/
http://win-builds.org/next/packages/windows_64/
- Changed:
pcre3.dll -> libpcre-1.dll
pcre.lib -> libpcre-1.lib
Wolfgang Stöggl [Mon, 9 Oct 2017 18:56:36 +0000 (20:56 +0200)]
Fix formal parameter different from declaration (#832)
- Fixes compiler warnings C4028 (MSVC):
formal parameter 2 different from declaration src\rrd_first.c 87
formal parameter 3 different from declaration src\rrd_graph_helper.c 1500
formal parameter 5 different from declaration src\rrd_modify.c 90
- Change "Use Run-Time Library" to /MD like in the .vcxproj files
- This fixes png display issues of "rrdtool.exe graph" within Cacti
* Fix macro redefinition warnings (MSVC)
- Move inclusion of errno.h before the redefinition of ENOBUFS and ENOTCONN
undef ENOBUFS and ENOTCONN before redefinition
- undef PATH_MAX before definition or redefinition
- Make definition of isinf, isnan and snprintf conditional
if _MSC_VER < 1900
These are supported since Visual Studio 2015
- Add comments and Visual Studio 2015 version details
Wolfgang Stöggl [Tue, 3 Oct 2017 19:05:48 +0000 (21:05 +0200)]
Update Makefile.msc, Windows build updates (#829)
* Add further Windows build files to .gitignore
- Added the following lines, sorted alphabetically:
/win32/*.VC.db
/win32/*.VC.opendb
/win32/.vs
/win32/DebugDLL
/win32/Static\ Debug
* Update Makefile.msc for Windows builds with nmake
- Added comment with usage information on top of the file
- Fixed typo CCPFlags -> CPPFLAGS
- Changed from /TP (specifies C++ source files)
to /TC (specifies C source files)
- Added zdll.lib gthread-2.0.lib pcre.lib to THIRD_PARTY_LIB
- Removed rrd_getopt.obj and rrd_getopt1.obj from RRD_LIB_OBJ_LIST
added optparse.obj instead
- Added further required .obj files to RRD_LIB_OBJ_LIST
- Added deletion of win32\*.obj to the clean section
- Building of rrdcgi.exe: changed from rrd_getopt.obj
and rrd_getopt1.obj to optparse.obj
- rc: include ./src, fixes:
./win32\rrd_config.h(119) : fatal error RC1015:
cannot open include file 'mkstemp.h'.
- Added compilation of .c files in ./win32 folder
* Update librrd-4.vcxproj
- Removed ../contrib/include/libpng12 from AdditionalIncludeDirectories
libpng12 has been updated to libpng14, but the include is not
necessary, because png.h is found in ../contrib/include too
- Removed <ClCompile Include="..\src\win32comp.c" />
definitions are already in rrd_thread_safe_nt.c
Fixes win32comp.obj :
error LNK2005: _localtime_r, _gmtime_r, _ctime_r, _strtok_r
already defined in rrd_thread_safe_nt.obj
- Removed /FORCE:MULTIPLE, which is not required any more after removal
of win32comp.c from compilation
* Update rrdtool.vcxproj
- Removed: IgnoreSpecificDefaultLibraries LIBCMTD.lib;LIBCMT.lib
Fixes failing build in case of 'Debug|Win32'
* Update rrdupdate.vcxproj
- Added . to AdditionalIncludeDirectories for 'Static Debug|Win32'
- Changed CompileAsCpp to CompileAsC
- Updated PlatformToolset from v120 to v140
- Added gthread-2.0.lib;pcre.lib to AdditionalDependencies
- Removed strftime=strftime_ from PreprocessorDefinitions
- Added /FORCE:MULTIPLE to AdditionalOptions for now
Fixes win32comp.obj :
error LNK2005: _localtime_r, _gmtime_r, _ctime_r, _strtok_r
already defined in rrd_thread_safe_nt.obj
- Removed rrd_getopt.c and rrd_getopt1.c, added optparse.c
- Added further .c files to ClCompile, sorted alphabetically
- Removed rrd_getopt.h
- Added further .h files to ClInclude, sorted alphabetically
* Update rrdtool.vcxproj
- Updated PlatformToolset from v120 to v140
- Added intl.dll and pcre3.dll to copy PostBuildEvent
* Update rrdupdate.vcxproj
- Updated PlatformToolset from v120 to v140
- Added intl.dll and pcre3.dll to copy PostBuildEvent
- Added . to AdditionalIncludeDirectories for Debug|Win32
* Include win32-glob.h, dirent.h, asprintf.h (MSC)
- Fixes compilation errors, when building under Windows (e.g. VS2015):
..\src\rrd_list.c(4): fatal error C1083: Cannot open include file:
'glob.h': No such file or directory
..\src\rrd_list.c(9): fatal error C1083: Cannot open include file:
'dirent.h': No such file or directory
librrd-4.lib(rrd_list.obj) : error LNK2001:
unresolved external symbol _asprintf
- Added includes for Windows builds (MSC):
"win32-glob.h" from https://sourceforge.net/projects/sox/
"dirent.h" from https://github.com/tronkko/dirent
"asprintf.h" from http://asprintf.insanecoding.org
* Add files required to build rrd_list.c (MSC)
The following files are added to the win32 directory
for building under Windows (e.g. VS2015):
- asprintf.c, asprintf.h, vasprintf-msvc.c
from http://asprintf.insanecoding.org
- dirent.h
from https://github.com/tronkko/dirent
- win32-glob.c, win32-glob.h
from https://sourceforge.net/projects/sox/
* Remove spurious executable permission from README
Wolfgang Stöggl [Tue, 26 Sep 2017 16:22:21 +0000 (18:22 +0200)]
Fix further build errors under Windows (#826)
* Define tzname_ for Windows builds (MSC)
- Fixes compilation error, when building under Windows (e.g. VS2015):
..\src\strftime.c(248): error C2065: 'tzname': undeclared identifier
- VS defines these variables with a leading underscore: _tzname
* Include win32/rrd_config.h for def of strncasecmp
- Fixes error, when building under Windows (e.g. VS2015):
error LNK2001: unresolved external symbol _strncasecmp
* Update win32/rrd_config.h, fix VS build errors
- Fix typo: strcasencmp -> strncasecmp
Fixes error, when building under Windows (e.g. VS2015):
error LNK2001: unresolved external symbol _strncasecmp
- Define S_ISREG(m)
Fixes error, when building under Windows (e.g. VS2015):
error LNK2001: unresolved external symbol _S_ISREG
- Define HAVE_PCRE_COMPILE for Windows builds
Fixes compilation error, when building under Windows (e.g. VS2015):
..\src\rrd_create.c(30): fatal error C1189: #error:
"you must have either glib with regexp support or libpcre"
Wolfgang Stöggl [Wed, 20 Sep 2017 08:40:03 +0000 (10:40 +0200)]
Include unistd.h only if HAVE_UNISTD_H is defined
- Fixes compilation error, when building under Windows (e.g. VS2015):
..\src\rrd_create.c(18): fatal error C1083: Cannot open include file:
'unistd.h': No such file or directory
Wolfgang Stöggl [Tue, 19 Sep 2017 14:48:39 +0000 (16:48 +0200)]
Avoid using VLA in optparse.c under Windows (MSC)
- Fixes compilation errors, when building under Windows (e.g. VS2015):
..\src\optparse.c(195): error C2057: expected constant expression
..\src\optparse.c(195): error C2466: cannot allocate an array of
constant size 0
..\src\optparse.c(195): error C2133: 'optstring': unknown size
- Variable length arrays are not currently supported in Visual Studio
- Use malloc() instead of variable length array in case of MSC
Wolfgang Stöggl [Mon, 18 Sep 2017 11:09:21 +0000 (13:09 +0200)]
Fix error 'optind': undeclared identifier
- Fixes compilation error, when building under Windows (e.g. VS2015):
..\src\rrd_tune.c(410): error C2065: 'optind': undeclared identifier
- Use options.optind instead of optind
optind is a member of the struct options
Wolfgang Stöggl [Thu, 14 Sep 2017 09:07:21 +0000 (11:07 +0200)]
Add missing files from win32 to Makefile.am
- Missing files were added in the Makefile.am to EXTRA_DIST
- The extra files will be included in the tarball
- See [rrd-users] message:
https://lists.oetiker.ch/pipermail/rrd-users/2016-August/020443.html
Alan Jenkins [Tue, 12 Sep 2017 13:00:42 +0000 (14:00 +0100)]
src/rrd_daemon.c: "comparison between pointer and zero character constant"
rrd_daemon.c: In function ‘handle_request_list’:
rrd_daemon.c:2587:22: warning: comparison between pointer and zero character constant [-Wpointer-compare]
} while (start_ptr != '\0');
^~
rrd_daemon.c:2587:12: note: did you mean to dereference the pointer?
} while (start_ptr != '\0');
I thought this might be related to what travis picked up with valgrind
here, but I couldn't reproduce it. Also I don't think this commit fixes a
bug; all it's doing is cleaning up the compiler warning.
Starting rrdcached...
OK: empty directory ./list1_dir returns nothing
==23957== LEAK SUMMARY:
==23957== definitely lost: 0 bytes in 0 blocks
==23957== indirectly lost: 0 bytes in 0 blocks
==23957== possibly lost: 0 bytes in 0 blocks
==23957== still reachable: 14,712 bytes in 6 blocks
==23957== suppressed: 0 bytes in 0 blocks
==23957==
==23957== For counts of detected and suppressed errors, rerun with: -v
==23957== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
FAILED: (rc=valgrind error) single file /list1.rrd
FAIL: list1
Alan Jenkins [Tue, 12 Sep 2017 12:17:54 +0000 (13:17 +0100)]
Fix valgrind usage in tests (#804)
* Fix leak of socket address in rrd_daemon
==11140== 59 bytes in 1 blocks are definitely lost in loss record 132
==11140== at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
==11140== by 0x6AD8CC9: strdup (in /usr/lib64/libc-2.24.so)
==11140== by 0x40A8AF: read_options (rrd_daemon.c:4493)
==11140== by 0x403114: main (rrd_daemon.c:4882)
* create a file in case the caller has difficulty testing the rc
e.g. because they pipe the output of rrdtool though something else.
Additional valgrind suppressions were needed in 20 out of 21 tests.
* tests: don't try to remove $VALGRIND_ERR_FILE when it doesn't exist
Fix non-fatal warning.
rm: cannot remove `/home/travis/build/oetiker/rrdtool-1.x/tests/
dump-restore-valgrind-err.tmp': No such file or directory