summaryrefslogtreecommitdiffstats
path: root/runtime/rsyslog.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-03-23 15:04:24 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-03-23 15:04:24 +0100
commit072fc663a83b2050d961d1c7ec7aa16f12842c9a (patch)
treeea701458975a339c4c729df7d72597cf4b300ea8 /runtime/rsyslog.c
parente0afe5c8258d4b70ade84f1176c44ae6d593f2df (diff)
downloadrsyslog-072fc663a83b2050d961d1c7ec7aa16f12842c9a.tar.gz
rsyslog-072fc663a83b2050d961d1c7ec7aa16f12842c9a.tar.xz
rsyslog-072fc663a83b2050d961d1c7ec7aa16f12842c9a.zip
added replacements for atomic instructions on systems that do not support them.
[backport of Stefen Sledz' patch for v5]
Diffstat (limited to 'runtime/rsyslog.c')
-rw-r--r--runtime/rsyslog.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/rsyslog.c b/runtime/rsyslog.c
index 443d0f41..5750ca76 100644
--- a/runtime/rsyslog.c
+++ b/runtime/rsyslog.c
@@ -80,6 +80,7 @@
#include "prop.h"
#include "rule.h"
#include "ruleset.h"
+#include "atomic.h"
/* forward definitions */
static rsRetVal dfltErrLogger(int, uchar *errMsg);
@@ -139,6 +140,12 @@ rsrtInit(char **ppErrObj, obj_if_t *pObjIF)
CHKiRet(objClassInit(NULL)); /* *THIS* *MUST* always be the first class initilizer being called! */
CHKiRet(objGetObjInterface(pObjIF)); /* this provides the root pointer for all other queries */
+#ifndef HAVE_ATOMIC_BUILTINS
+#ifdef HAVE_SEMAPHORE_H
+ CHKiRet(atomicSemInit());
+#endif /* HAVE_SEMAPHORE_H */
+#endif /* !defined(HAVE_ATOMIC_BUILTINS) */
+
/* initialize core classes. We must be very careful with the order of events. Some
* classes use others and if we do not initialize them in the right order, we may end
* up with an invalid call. The most important thing that can happen is that an error
@@ -215,6 +222,13 @@ rsrtExit(void)
glblClassExit();
rulesetClassExit();
ruleClassExit();
+
+#ifndef HAVE_ATOMIC_BUILTINS
+#ifdef HAVE_SEMAPHORE_H
+ atomicSemExit();
+#endif /* HAVE_SEMAPHORE_H */
+#endif /* !defined(HAVE_ATOMIC_BUILTINS) */
+
objClassExit(); /* *THIS* *MUST/SHOULD?* always be the first class initilizer being called (except debug)! */
}