summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-12-02 07:28:04 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-12-02 07:28:04 +0100
commit1bfb97e576d779a709e1e2979eef4697b9b0cd16 (patch)
treefc77b27e671ef9925d8daeb35b1a7afd71636c1e
parentf8769ca19da2eff26dd80ca3b6217d078db1a59f (diff)
downloadrsyslog-1bfb97e576d779a709e1e2979eef4697b9b0cd16.tar.gz
rsyslog-1bfb97e576d779a709e1e2979eef4697b9b0cd16.tar.xz
rsyslog-1bfb97e576d779a709e1e2979eef4697b9b0cd16.zip
bugfix: one type of 64bit atomics was enabled when 32bit atomics were supported
also cleaned up some minor things
-rw-r--r--runtime/atomic.h27
-rw-r--r--tools/syslogd.c14
2 files changed, 17 insertions, 24 deletions
diff --git a/runtime/atomic.h b/runtime/atomic.h
index c022035c..3e2c0d18 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -46,7 +46,6 @@
# define ATOMIC_INC(data, phlpmut) ((void) __sync_fetch_and_add(data, 1))
# define ATOMIC_INC_AND_FETCH_int(data, phlpmut) __sync_fetch_and_add(data, 1)
# define ATOMIC_INC_AND_FETCH_unsigned(data, phlpmut) __sync_fetch_and_add(data, 1)
-# define ATOMIC_INC_AND_FETCH_uint64(data, phlpmut) __sync_fetch_and_add(data, 1)
# define ATOMIC_DEC(data, phlpmut) ((void) __sync_sub_and_fetch(data, 1))
# define ATOMIC_DEC_AND_FETCH(data, phlpmut) __sync_sub_and_fetch(data, 1)
# define ATOMIC_FETCH_32BIT(data, phlpmut) ((unsigned) __sync_fetch_and_and(data, 0xffffffff))
@@ -160,15 +159,6 @@
return(val);
}
- static inline unsigned
- ATOMIC_INC_AND_FETCH_uint64(uint64 *data, pthread_mutex_t *phlpmut) {
- uint64 val;
- pthread_mutex_lock(phlpmut);
- val = ++(*data);
- pthread_mutex_unlock(phlpmut);
- return(val);
- }
-
static inline int
ATOMIC_DEC_AND_FETCH(int *data, pthread_mutex_t *phlpmut) {
int val;
@@ -193,13 +183,6 @@
(*data) -= val;
pthread_mutex_unlock(phlpmut);
}
-#if 0
-# warning "atomic builtins not available, using nul operations - rsyslogd will probably be racy!"
-# define ATOMIC_INC_AND_FETCH_int(data) (++(data))
-# define ATOMIC_INC_AND_FETCH_unsigned(data) (++(data))
-# define ATOMIC_INC_AND_FETCH_uint64(data) (++(data))
-# define ATOMIC_STORE_1_TO_32BIT(data) (data) = 1 // TODO: del
-#endif
# define DEF_ATOMIC_HELPER_MUT(x) pthread_mutex_t x
# define INIT_ATOMIC_HELPER_MUT(x) pthread_mutex_init(&(x), NULL)
# define DESTROY_ATOMIC_HELPER_MUT(x) pthread_mutex_destroy(&(x))
@@ -214,6 +197,7 @@
#ifdef HAVE_ATOMIC_BUILTINS_64BIT
# define ATOMIC_INC_uint64(data, phlpmut) ((void) __sync_fetch_and_add(data, 1))
# define ATOMIC_DEC_unit64(data, phlpmut) ((void) __sync_sub_and_fetch(data, 1))
+# define ATOMIC_INC_AND_FETCH_uint64(data, phlpmut) __sync_fetch_and_add(data, 1)
# define DEF_ATOMIC_HELPER_MUT64(x)
# define INIT_ATOMIC_HELPER_MUT64(x)
@@ -230,6 +214,15 @@
pthread_mutex_unlock(phlpmut); \
}
+ static inline unsigned
+ ATOMIC_INC_AND_FETCH_uint64(uint64 *data, pthread_mutex_t *phlpmut) {
+ uint64 val;
+ pthread_mutex_lock(phlpmut);
+ val = ++(*data);
+ pthread_mutex_unlock(phlpmut);
+ return(val);
+ }
+
# define DEF_ATOMIC_HELPER_MUT64(x) pthread_mutex_t x
# define INIT_ATOMIC_HELPER_MUT64(x) pthread_mutex_init(&(x), NULL)
# define DESTROY_ATOMIC_HELPER_MUT64(x) pthread_mutex_destroy(&(x))
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 4964f8fc..70d4cf2e 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2111,11 +2111,6 @@ static void printVersion(void)
#else
printf("\tFEATURE_LARGEFILE:\t\t\tNo\n");
#endif
-#ifdef USE_NETZIP
- printf("\tFEATURE_NETZIP (message compression):\tYes\n");
-#else
- printf("\tFEATURE_NETZIP (message compression):\tNo\n");
-#endif
#if defined(SYSLOG_INET) && defined(USE_GSSAPI)
printf("\tGSSAPI Kerberos 5 support:\t\tYes\n");
#else
@@ -2127,9 +2122,14 @@ static void printVersion(void)
printf("\tFEATURE_DEBUG (debug build, slow code):\tNo\n");
#endif
#ifdef HAVE_ATOMIC_BUILTINS
- printf("\tAtomic operations supported:\t\tYes\n");
+ printf("\t32bit Atomic operations supported:\tYes\n");
+#else
+ printf("\t32bit Atomic operations supported:\tNo\n");
+#endif
+#ifdef HAVE_ATOMIC_BUILTINS64
+ printf("\t64bit Atomic operations supported:\tYes\n");
#else
- printf("\tAtomic operations supported:\t\tNo\n");
+ printf("\t64bit Atomic operations supported:\tNo\n");
#endif
#ifdef RTINST
printf("\tRuntime Instrumentation (slow code):\tYes\n");