From abdc2870f1ebbf21a1b865804c512b1ffbeebb3a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 9 Dec 2009 16:49:07 +0100 Subject: worked around an issue where omfile failed to compile on 32 bit platforms ...under some circumstances (this smells like a gcc problem, but a simple solution was available). Thanks to Kenneth Marshall for some advice. [backported from 5.5.x branch] --- ChangeLog | 4 ++++ configure.ac | 1 + m4/atomic_operations_64bit.m4 | 53 +++++++++++++++++++++++++++++++++++++++++++ tools/omfile.c | 4 ++++ 4 files changed, 62 insertions(+) create mode 100644 m4/atomic_operations_64bit.m4 diff --git a/ChangeLog b/ChangeLog index adaa4afa..362222f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,10 @@ Version 5.3.6 [BETA] (rgerhards), 2009-11-?? Thanks to Jonathan Bond-Caron for the patch. - bugfix: $CreateDirs variable not properly initialized, default thus was random (but most often "on") [imported from v3] +- worked around an issue where omfile failed to compile on 32 bit platforms + under some circumstances (this smells like a gcc problem, but a simple + solution was available). Thanks to Kenneth Marshall for some advice. + [backported from 5.5.x branch] --------------------------------------------------------------------------- Version 5.3.5 [BETA] (rgerhards), 2009-11-13 - some light performance enhancement by replacing time() call with much diff --git a/configure.ac b/configure.ac index d850dfda..85f2c75a 100644 --- a/configure.ac +++ b/configure.ac @@ -128,6 +128,7 @@ AC_TRY_COMPILE([ # check for availability of atomic operations RS_ATOMIC_OPERATIONS +RS_ATOMIC_OPERATIONS_64BIT # Additional module directories diff --git a/m4/atomic_operations_64bit.m4 b/m4/atomic_operations_64bit.m4 new file mode 100644 index 00000000..3121cf15 --- /dev/null +++ b/m4/atomic_operations_64bit.m4 @@ -0,0 +1,53 @@ +# rsyslog +# +# atomic_operations.m4 - autoconf macro to check if compiler supports atomic +# operations +# +# rgerhards, 2008-09-18, added based on +# http://svn.apache.org/repos/asf/apr/apr/trunk/configure.in +# +# +AC_DEFUN([RS_ATOMIC_OPERATIONS_64BIT], +[AC_CACHE_CHECK([whether the compiler provides atomic builtins for 64 bit data types], [ap_cv_atomic_builtins_64], +[AC_TRY_RUN([ +int main() +{ + unsigned long long val = 1010, tmp, *mem = &val; + + if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020) + return 1; + + tmp = val; + + if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010) + return 1; + + if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0) + return 1; + + tmp = 3030; + + if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp) + return 1; + + if (__sync_lock_test_and_set(&val, 4040) != 3030) + return 1; + + mem = &tmp; + + if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp) + return 1; + + __sync_synchronize(); + + if (mem != &val) + return 1; + + return 0; +}], [ap_cv_atomic_builtins_64=yes], [ap_cv_atomic_builtins_64=no], [ap_cv_atomic_builtins_64=no])]) + +if test "$ap_cv_atomic_builtins_64" = "yes"; then + AC_DEFINE(HAVE_ATOMIC_BUILTINS_64BIT, 1, [Define if compiler provides 64 bit atomic builtins]) +fi + +]) diff --git a/tools/omfile.c b/tools/omfile.c index 13bb74ad..3a206ebf 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -83,7 +83,11 @@ DEFobjCurrIf(strm) * That should be sufficient (and even than, there would no really bad effect ;)). * The variable below is the global counter/clock. */ +#if HAVE_ATOMIC_BUILTINS_64BIT static uint64 clockFileAccess = 0; +#else +static unsigned clockFileAccess = 0; +#endif /* and the "tick" function */ static inline uint64 getClockFileAccess(void) -- cgit v1.2.3 From c9125981998541b63eaa55c7cdedb46fe2ae2701 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 11 Dec 2009 12:17:02 +0100 Subject: bugfix: ompgsql had problems with transaction support, what actually rendered it unsuable. Thanks to forum user "horhe" for alerting me on this bug and helping to debug/fix it! --- ChangeLog | 3 +++ plugins/ompgsql/ompgsql.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 362222f6..37f04988 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ Version 5.3.6 [BETA] (rgerhards), 2009-11-?? Thanks to Jonathan Bond-Caron for the patch. - bugfix: $CreateDirs variable not properly initialized, default thus was random (but most often "on") [imported from v3] +- bugfix: ompgsql had problems with transaction support, what actually + rendered it unsuable. Thanks to forum user "horhe" for alerting me + on this bug and helping to debug/fix it! - worked around an issue where omfile failed to compile on 32 bit platforms under some circumstances (this smells like a gcc problem, but a simple solution was available). Thanks to Kenneth Marshall for some advice. diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c index cb6b6a4d..5a6ad733 100644 --- a/plugins/ompgsql/ompgsql.c +++ b/plugins/ompgsql/ompgsql.c @@ -245,7 +245,9 @@ ENDbeginTransaction BEGINdoAction CODESTARTdoAction dbgprintf("\n"); - iRet = writePgSQL(ppString[0], pData); + CHKiRet(writePgSQL(ppString[0], pData)); + iRet = RS_RET_DEFER_COMMIT; +finalize_it: ENDdoAction -- cgit v1.2.3