On 28/07/2012, at 8:54 AM, jpe...@apache.org wrote: > Updated Branches: > refs/heads/master b4d4f4a9a -> 76aa879db > > > TS-1385: generic atomic operations API
This is supposed to be a no-impact change, but please review and keep an eye out for regressions since touching atomics is probably intrinsically risky ... thanks! James > > > Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo > Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/76aa879d > Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/76aa879d > Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/76aa879d > > Branch: refs/heads/master > Commit: 76aa879db6d7d418486afba8804893d2133a5811 > Parents: b4d4f4a > Author: James Peach <jpe...@apache.org> > Authored: Sat Jul 28 08:54:33 2012 -0700 > Committer: James Peach <jpe...@apache.org> > Committed: Sat Jul 28 08:54:33 2012 -0700 > > ---------------------------------------------------------------------- > CHANGES | 2 + > iocore/cache/P_CacheHosting.h | 2 +- > iocore/cluster/ClusterMachine.cc | 2 +- > iocore/dns/P_SplitDNSProcessor.h | 4 +- > iocore/dns/SplitDNS.cc | 4 +- > iocore/eventsystem/P_IOBuffer.h | 8 ++-- > iocore/net/UnixUDPNet.cc | 6 +- > lib/records/RecCore.cc | 10 ++-- > lib/records/RecProcess.cc | 36 +++++++------- > lib/ts/ink_atomic.h | 73 +++++++++++++++------------- > lib/ts/ink_queue.cc | 22 ++++---- > lib/ts/test_atomic.cc | 6 +- > plugins/experimental/geoip_acl/lulu.h | 12 ++-- > proxy/AbstractBuffer.h | 2 +- > proxy/CacheControl.cc | 2 +- > proxy/IPAllow.cc | 2 +- > proxy/ParentSelection.cc | 6 +- > proxy/ParentSelection.h | 2 +- > proxy/ProxyConfig.cc | 2 +- > proxy/ProxyConfig.h | 4 +- > proxy/ReverseProxy.cc | 2 +- > proxy/StatSystem.cc | 10 ++-- > proxy/StatSystem.h | 16 +++--- > proxy/congest/Congestion.cc | 2 +- > proxy/http/HttpClientSession.cc | 2 +- > proxy/http/HttpServerSession.cc | 2 +- > proxy/http/HttpTransact.cc | 9 +--- > proxy/logging/Log.cc | 2 +- > proxy/logging/LogBuffer.h | 2 +- > proxy/logging/LogConfig.cc | 2 +- > proxy/logging/LogObject.cc | 6 +- > 31 files changed, 133 insertions(+), 129 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/CHANGES > ---------------------------------------------------------------------- > diff --git a/CHANGES b/CHANGES > index 052de74..ef89d62 100644 > --- a/CHANGES > +++ b/CHANGES > @@ -1,5 +1,7 @@ > -*- coding: utf-8 -*- > Changes with Apache Traffic Server 3.3.0 > + *) [TS-1385] generic atomic operations API > + > *) [TS-1380] SSL wildcard lookup doesn't find the longest match > > *) [TS-1315] Fix URL parsing to handle non-HTTP schemes correctly. > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/iocore/cache/P_CacheHosting.h > ---------------------------------------------------------------------- > diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h > index 2f5c7e3..871ba8f 100644 > --- a/iocore/cache/P_CacheHosting.h > +++ b/iocore/cache/P_CacheHosting.h > @@ -150,7 +150,7 @@ struct CacheHostTableConfig: public Continuation > (void) e; > (void) event; > CacheHostTable *t = NEW(new CacheHostTable((*ppt)->cache, (*ppt)->type)); > - CacheHostTable *old = (CacheHostTable *) ink_atomic_swap_ptr(&t, ppt); > + CacheHostTable *old = (CacheHostTable *) ink_atomic_swap(&t, *ppt); > new_Deleter(old, CACHE_MEM_FREE_TIMEOUT); > return EVENT_DONE; > } > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/iocore/cluster/ClusterMachine.cc > ---------------------------------------------------------------------- > diff --git a/iocore/cluster/ClusterMachine.cc > b/iocore/cluster/ClusterMachine.cc > index cd056e2..4607191 100644 > --- a/iocore/cluster/ClusterMachine.cc > +++ b/iocore/cluster/ClusterMachine.cc > @@ -154,7 +154,7 @@ ClusterHandler *ClusterMachine::pop_ClusterHandler(int > no_rr) > { > int64_t now = rr_count; > if (no_rr == 0) > - ink_atomic_increment64(&rr_count, 1); > + ink_atomic_increment(&rr_count, 1); > return this->clusterHandlers[now % this->num_connections]; > } > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/iocore/dns/P_SplitDNSProcessor.h > ---------------------------------------------------------------------- > diff --git a/iocore/dns/P_SplitDNSProcessor.h > b/iocore/dns/P_SplitDNSProcessor.h > index 38ce322..c89869b 100644 > --- a/iocore/dns/P_SplitDNSProcessor.h > +++ b/iocore/dns/P_SplitDNSProcessor.h > @@ -108,8 +108,8 @@ public: > void release(unsigned int id, SplitDNSConfigInfo * data); > > public: > - volatile SplitDNSConfigInfo *infos[MAX_CONFIGS]; > - volatile int ninfos; > + SplitDNSConfigInfo *infos[MAX_CONFIGS]; > + int ninfos; > }; > > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/iocore/dns/SplitDNS.cc > ---------------------------------------------------------------------- > diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc > index 871e898..00c6943 100644 > --- a/iocore/dns/SplitDNS.cc > +++ b/iocore/dns/SplitDNS.cc > @@ -635,8 +635,8 @@ SplitDNSConfigProcessor::set(unsigned int id, > SplitDNSConfigInfo * info) > idx = id - 1; > > do { > - old_info = (SplitDNSConfigInfo *) infos[idx]; > - } while (!ink_atomic_cas_ptr((pvvoidp) & infos[idx], old_info, info)); > + old_info = infos[idx]; > + } while (!ink_atomic_cas( &infos[idx], old_info, info)); > > if (old_info) { > eventProcessor.schedule_in(NEW(new SplitDNSConfigInfoReleaser(id, > old_info)), HRTIME_SECONDS(60)); > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/iocore/eventsystem/P_IOBuffer.h > ---------------------------------------------------------------------- > diff --git a/iocore/eventsystem/P_IOBuffer.h b/iocore/eventsystem/P_IOBuffer.h > index f941933..f626308 100644 > --- a/iocore/eventsystem/P_IOBuffer.h > +++ b/iocore/eventsystem/P_IOBuffer.h > @@ -150,10 +150,10 @@ iobuffer_mem_inc(const char *_loc, int64_t _size_index) > Resource *res = res_lookup(_loc); > ink_debug_assert(strcmp(_loc, res->path) == 0); > #ifdef DEBUG > - int64_t r = ink_atomic_increment64(&res->value, > index_to_buffer_size(_size_index)); > + int64_t r = ink_atomic_increment(&res->value, > index_to_buffer_size(_size_index)); > ink_debug_assert(r >= 0); > #else > - ink_atomic_increment64(&res->value, index_to_buffer_size(_size_index)); > + ink_atomic_increment(&res->value, index_to_buffer_size(_size_index)); > #endif > } > > @@ -170,10 +170,10 @@ iobuffer_mem_dec(const char *_loc, int64_t _size_index) > Resource *res = res_lookup(_loc); > ink_debug_assert(strcmp(_loc, res->path) == 0); > #ifdef DEBUG > - int64_t r = ink_atomic_increment64(&res->value, > -index_to_buffer_size(_size_index)); > + int64_t r = ink_atomic_increment(&res->value, > -index_to_buffer_size(_size_index)); > ink_debug_assert(r >= index_to_buffer_size(_size_index)); > #else > - ink_atomic_increment64(&res->value, -index_to_buffer_size(_size_index)); > + ink_atomic_increment(&res->value, -index_to_buffer_size(_size_index)); > #endif > } > #endif > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/iocore/net/UnixUDPNet.cc > ---------------------------------------------------------------------- > diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc > index 423bd6c..c939f0f 100644 > --- a/iocore/net/UnixUDPNet.cc > +++ b/iocore/net/UnixUDPNet.cc > @@ -701,7 +701,7 @@ UDPNetProcessor::AllocBandwidth(Continuation * udpConn, > double desiredMbps) > } > udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0; > udpIntConn->allocedbps = desiredbps; > - > ink_atomic_increment64(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, > desiredbps); > + > ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, > desiredbps); > Debug("udpnet-admit", "Admitting flow with %lf Mbps (a=%" PRId64 ", lim=%" > PRId64 ")", > desiredMbps, > G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, > @@ -729,7 +729,7 @@ UDPNetProcessor::ChangeBandwidth(Continuation * udpConn, > double desiredMbps) > } > udpIntConn->flowRateBps = (desiredMbps * 1024.0 * 1024.0) / 8.0; > udpIntConn->allocedbps = desiredbps; > - > ink_atomic_increment64(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, > desiredbps - oldbps); > + > ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, > desiredbps - oldbps); > Debug("udpnet-admit", "Changing flow's b/w from %lf Mbps to %lf Mbps (a=%" > PRId64 ", lim=%" PRId64 ")", > (double) oldbps / (1024.0 * 1024.0), > desiredMbps, > @@ -753,7 +753,7 @@ UDPNetProcessor::FreeBandwidth(Continuation * udpConn) > if (bps <= 0) > return; > > - > ink_atomic_increment64(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, > -bps); > + > ink_atomic_increment(&G_inkPipeInfo.perPipeInfo[udpIntConn->pipe_class].bwAlloc, > -bps); > > Debug("udpnet-free", "Releasing %lf Kbps", bps / 1024.0); > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/lib/records/RecCore.cc > ---------------------------------------------------------------------- > diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc > index 83a1574..d9215ed 100644 > --- a/lib/records/RecCore.cc > +++ b/lib/records/RecCore.cc > @@ -97,7 +97,7 @@ link_int(const char *name, RecDataT data_type, RecData > data, void *cookie) > REC_NOWARN_UNUSED(name); > REC_NOWARN_UNUSED(data_type); > RecInt *rec_int = (RecInt *) cookie; > - ink_atomic_swap64(rec_int, data.rec_int); > + ink_atomic_swap(rec_int, data.rec_int); > return REC_ERR_OKAY; > } > > @@ -134,7 +134,7 @@ link_counter(const char *name, RecDataT data_type, > RecData data, void *cookie) > REC_NOWARN_UNUSED(name); > REC_NOWARN_UNUSED(data_type); > RecCounter *rec_counter = (RecCounter *) cookie; > - ink_atomic_swap64(rec_counter, data.rec_counter); > + ink_atomic_swap(rec_counter, data.rec_counter); > return REC_ERR_OKAY; > } > > @@ -148,7 +148,7 @@ link_byte(const char *name, RecDataT data_type, RecData > data, void *cookie) > RecByte *rec_byte = (RecByte *) cookie; > RecByte byte = static_cast<RecByte>(data.rec_int); > > - ink_atomic_swap8(rec_byte, byte); > + ink_atomic_swap(rec_byte, byte); > return REC_ERR_OKAY; > } > > @@ -188,7 +188,7 @@ RecCoreInit(RecModeT mode_type, Diags *_diags) > } > > // set our diags > - ink_atomic_swap_ptr(&g_diags, _diags); > + ink_atomic_swap(&g_diags, _diags); > > g_records_tree = new RecTree(NULL); > g_num_records = 0; > @@ -251,7 +251,7 @@ RecSetDiags(Diags * _diags) > { > // Warning! It's very dangerous to change diags on the fly! This > // function only exists so that we can boot-strap TM on startup. > - ink_atomic_swap_ptr(&g_diags, _diags); > + ink_atomic_swap(&g_diags, _diags); > return REC_ERR_OKAY; > } > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/lib/records/RecProcess.cc > ---------------------------------------------------------------------- > diff --git a/lib/records/RecProcess.cc b/lib/records/RecProcess.cc > index 985173c..b27fb93 100644 > --- a/lib/records/RecProcess.cc > +++ b/lib/records/RecProcess.cc > @@ -122,12 +122,12 @@ raw_stat_sync_to_global(RecRawStatBlock *rsb, int id) > //rsb, id, delta.sum, total.sum, rsb->global[id]->last_sum, > rsb->global[id]->sum); > > // increment the global values by the delta > - ink_atomic_increment64(&(rsb->global[id]->sum), delta.sum); > - ink_atomic_increment64(&(rsb->global[id]->count), delta.count); > + ink_atomic_increment(&(rsb->global[id]->sum), delta.sum); > + ink_atomic_increment(&(rsb->global[id]->count), delta.count); > > // set the new totals as the last values seen > - ink_atomic_swap64(&(rsb->global[id]->last_sum), total.sum); > - ink_atomic_swap64(&(rsb->global[id]->last_count), total.count); > + ink_atomic_swap(&(rsb->global[id]->last_sum), total.sum); > + ink_atomic_swap(&(rsb->global[id]->last_count), total.count); > > ink_mutex_release(&(rsb->mutex)); > > @@ -146,15 +146,15 @@ raw_stat_clear_sum(RecRawStatBlock *rsb, int id) > // the globals need to be reset too > // lock so the setting of the globals and last values are atomic > ink_mutex_acquire(&(rsb->mutex)); > - ink_atomic_swap64(&(rsb->global[id]->sum), 0); > - ink_atomic_swap64(&(rsb->global[id]->last_sum), 0); > + ink_atomic_swap(&(rsb->global[id]->sum), (int64_t)0); > + ink_atomic_swap(&(rsb->global[id]->last_sum), (int64_t)0); > ink_mutex_release(&(rsb->mutex)); > > // reset the local stats > RecRawStat *tlp; > for (int i = 0; i < eventProcessor.n_ethreads; i++) { > tlp = ((RecRawStat *) ((char *) (eventProcessor.all_ethreads[i]) + > rsb->ethr_stat_offset)) + id; > - ink_atomic_swap64(&(tlp->sum), 0); > + ink_atomic_swap(&(tlp->sum), (int64_t)0); > } > return REC_ERR_OKAY; > } > @@ -171,15 +171,15 @@ raw_stat_clear_count(RecRawStatBlock *rsb, int id) > // the globals need to be reset too > // lock so the setting of the globals and last values are atomic > ink_mutex_acquire(&(rsb->mutex)); > - ink_atomic_swap64(&(rsb->global[id]->count), 0); > - ink_atomic_swap64(&(rsb->global[id]->last_count), 0); > + ink_atomic_swap(&(rsb->global[id]->count), (int64_t)0); > + ink_atomic_swap(&(rsb->global[id]->last_count), (int64_t)0); > ink_mutex_release(&(rsb->mutex)); > > // reset the local stats > RecRawStat *tlp; > for (int i = 0; i < eventProcessor.n_ethreads; i++) { > tlp = ((RecRawStat *) ((char *) (eventProcessor.all_ethreads[i]) + > rsb->ethr_stat_offset)) + id; > - ink_atomic_swap64(&(tlp->count), 0); > + ink_atomic_swap(&(tlp->count), (int64_t)0); > } > return REC_ERR_OKAY; > } > @@ -606,7 +606,7 @@ int > RecSetRawStatSum(RecRawStatBlock *rsb, int id, int64_t data) > { > raw_stat_clear_sum(rsb, id); > - ink_atomic_swap64(&(rsb->global[id]->sum), data); > + ink_atomic_swap(&(rsb->global[id]->sum), data); > return REC_ERR_OKAY; > } > > @@ -614,7 +614,7 @@ int > RecSetRawStatCount(RecRawStatBlock *rsb, int id, int64_t data) > { > raw_stat_clear_count(rsb, id); > - ink_atomic_swap64(&(rsb->global[id]->count), data); > + ink_atomic_swap(&(rsb->global[id]->count), data); > return REC_ERR_OKAY; > } > > @@ -658,22 +658,22 @@ RecGetRawStatCount(RecRawStatBlock *rsb, int id, > int64_t *data) > int > RecIncrGlobalRawStat(RecRawStatBlock *rsb, int id, int64_t incr) > { > - ink_atomic_increment64(&(rsb->global[id]->sum), incr); > - ink_atomic_increment64(&(rsb->global[id]->count), 1); > + ink_atomic_increment(&(rsb->global[id]->sum), incr); > + ink_atomic_increment(&(rsb->global[id]->count), 1); > return REC_ERR_OKAY; > } > > int > RecIncrGlobalRawStatSum(RecRawStatBlock *rsb, int id, int64_t incr) > { > - ink_atomic_increment64(&(rsb->global[id]->sum), incr); > + ink_atomic_increment(&(rsb->global[id]->sum), incr); > return REC_ERR_OKAY; > } > > int > RecIncrGlobalRawStatCount(RecRawStatBlock *rsb, int id, int64_t incr) > { > - ink_atomic_increment64(&(rsb->global[id]->count), incr); > + ink_atomic_increment(&(rsb->global[id]->count), incr); > return REC_ERR_OKAY; > } > > @@ -684,14 +684,14 @@ RecIncrGlobalRawStatCount(RecRawStatBlock *rsb, int id, > int64_t incr) > int > RecSetGlobalRawStatSum(RecRawStatBlock *rsb, int id, int64_t data) > { > - ink_atomic_swap64(&(rsb->global[id]->sum), data); > + ink_atomic_swap(&(rsb->global[id]->sum), data); > return REC_ERR_OKAY; > } > > int > RecSetGlobalRawStatCount(RecRawStatBlock *rsb, int id, int64_t data) > { > - ink_atomic_swap64(&(rsb->global[id]->count), data); > + ink_atomic_swap(&(rsb->global[id]->count), data); > return REC_ERR_OKAY; > } > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/lib/ts/ink_atomic.h > ---------------------------------------------------------------------- > diff --git a/lib/ts/ink_atomic.h b/lib/ts/ink_atomic.h > index 3e358c6..3d3f8b2 100644 > --- a/lib/ts/ink_atomic.h > +++ b/lib/ts/ink_atomic.h > @@ -50,12 +50,14 @@ typedef volatile int8_t vint8; > typedef volatile int16_t vint16; > typedef volatile int32_t vint32; > typedef volatile int64_t vint64; > +typedef volatile long vlong; > typedef volatile void *vvoidp; > > typedef vint8 *pvint8; > typedef vint16 *pvint16; > typedef vint32 *pvint32; > typedef vint64 *pvint64; > +typedef vlong *pvlong; > typedef vvoidp *pvvoidp; > > // Sun/Solaris and the SunPRO compiler > @@ -76,51 +78,58 @@ typedef vuint64_s *pvuint64_s; > > #include <atomic.h> > > -static inline int8_t ink_atomic_swap8(pvint8 mem, int8_t value) { return > (int8_t)atomic_swap_8((pvuint8)mem, (uint8_t)value); } > -static inline int16_t ink_atomic_swap16(pvint16 mem, int16_t value) { return > (int16_t)atomic_swap_16((pvuint16)mem, (uint16_t)value); } > -static inline int32_t ink_atomic_swap32(pvint32 mem, int32_t value) { return > (int32_t)atomic_swap_32((pvuint32)mem, (uint32_t)value); } > - > +static inline int8_t ink_atomic_swap(pvint8 mem, int8_t value) { return > (int8_t)atomic_swap_8((pvuint8)mem, (uint8_t)value); } > +static inline int16_t ink_atomic_swap(pvint16 mem, int16_t value) { return > (int16_t)atomic_swap_16((pvuint16)mem, (uint16_t)value); } > static inline int32_t ink_atomic_swap(pvint32 mem, int32_t value) { return > (int32_t)atomic_swap_32((pvuint32)mem, (uint32_t)value); } > -static inline int64_t ink_atomic_swap64(pvint64 mem, int64_t value) { return > (int64_t)atomic_swap_64((pvuint64_s)mem, (uint64_s)value); } > -static inline void *ink_atomic_swap_ptr(vvoidp mem, void *value) { return > atomic_swap_ptr((vvoidp)mem, value); } > +static inline int64_t ink_atomic_swap(pvint64 mem, int64_t value) { return > (int64_t)atomic_swap_64((pvuint64_s)mem, (uint64_s)value); } > +static inline void * ink_atomic_swap(vvoidp mem, void *value) { return > atomic_swap_ptr((vvoidp)mem, value); } > > static inline int ink_atomic_cas(pvint32 mem, int old, int new_value) { > return atomic_cas_32((pvuint32)mem, (uint32_t)old, (uint32_t)new_value) == > old; } > -static inline int ink_atomic_cas64(pvint64 mem, int64_t old, int64_t > new_value) { return atomic_cas_64((pvuint64_s)mem, (uint64_s)old, > (uint64_s)new_value) == old; } > -static inline int ink_atomic_cas_ptr(pvvoidp mem, void* old, void* > new_value) { return atomic_cas_ptr((vvoidp)mem, old, new_value) == old; } > -static inline int ink_atomic_increment(pvint32 mem, int value) { return > ((uint32_t)atomic_add_32_nv((pvuint32)mem, (uint32_t)value)) - value; } > -static inline int64_t ink_atomic_increment64(pvint64 mem, int64_t value) { > return ((uint64_s)atomic_add_64_nv((pvuint64_s)mem, (uint64_s)value)) - > value; } > -static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t value) { > return (void*)(((char*)atomic_add_ptr_nv((vvoidp)mem, (ssize_t)value)) - > value); } > +static inline int ink_atomic_cas(pvint64 mem, int64_t old, int64_t > new_value) { return atomic_cas_64((pvuint64_s)mem, (uint64_s)old, > (uint64_s)new_value) == old; } > +static inline int ink_atomic_cas(pvvoidp mem, void* old, void* new_value) { > return atomic_cas_ptr((vvoidp)mem, old, new_value) == old; } > + > +static inline int ink_atomic_increment(pvint32 mem, int value) { return > ((uint32_t)atomic_add_32_nv((pvuint32)mem, (uint32_t)value)) - value; } > +static inline int64_t ink_atomic_increment(pvint64 mem, int64_t value) { > return ((uint64_s)atomic_add_64_nv((pvuint64_s)mem, (uint64_s)value)) - > value; } > +static inline void * ink_atomic_increment(pvvoidp mem, intptr_t value) { > return (void*)(((char*)atomic_add_ptr_nv((vvoidp)mem, (ssize_t)value)) - > value); } > > /* not used for Intel Processors or Sparc which are mostly sequentally > consistent */ > #define INK_WRITE_MEMORY_BARRIER > #define INK_MEMORY_BARRIER > > -#else /* ! defined(__SUNPRO_CC) */ > - > /* GCC compiler >= 4.1 */ > -#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 1) > +#elif defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 1) > > /* see http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html */ > > -static inline int8_t ink_atomic_swap8(pvint8 mem, int8_t value) { return > __sync_lock_test_and_set(mem, value); } > -static inline int16_t ink_atomic_swap16(pvint16 mem, int16_t value) { return > __sync_lock_test_and_set(mem, value); } > -static inline int32_t ink_atomic_swap32(pvint32 mem, int32_t value) { return > __sync_lock_test_and_set(mem, value); } > - > -static inline int32_t ink_atomic_swap(pvint32 mem, int32_t value) { return > __sync_lock_test_and_set(mem, value); } > -static inline void *ink_atomic_swap_ptr(vvoidp mem, void *value) { return > __sync_lock_test_and_set((void**)mem, value); } > +// ink_atomic_swap(ptr, value) > +// Writes @value into @ptr, returning the previous value. > +template <typename T> static inline T > +ink_atomic_swap(volatile T * mem, T value) { > + return __sync_lock_test_and_set(mem, value); > +} > > -static inline int ink_atomic_cas(pvint32 mem, int old, int new_value) { > return __sync_bool_compare_and_swap(mem, old, new_value); } > -static inline int ink_atomic_cas_ptr(pvvoidp mem, void* old, void* > new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); } > +// ink_atomic_cas(mem, prev, next) > +// Atomically store the value @next into the pointer @mem, but only if the > current value at @mem is @prev. > +// Returns true if @next was successfully stored. > +template <typename T> static inline bool > +ink_atomic_cas(volatile T * mem, T prev, T next) { > + return __sync_bool_compare_and_swap(mem, prev, next); > +} > > -static inline int ink_atomic_increment(pvint32 mem, int value) { return > __sync_fetch_and_add(mem, value); } > -static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t value) { > return __sync_fetch_and_add((void**)mem, (void*)value); } > +// ink_atomic_increment(ptr, count) > +// Increment @ptr by @count, returning the previous value. > +template <typename Type, typename Amount> static inline Type > +ink_atomic_increment(volatile Type * mem, Amount count) { > + return __sync_fetch_and_add(mem, (Type)count); > +} > > // Special hacks for ARM 32-bit > #if defined(__arm__) && (SIZEOF_VOIDP == 4) > extern ProcessMutex __global_death; > > +template<> > static inline int64_t > -ink_atomic_swap64(pvint64 mem, int64_t value) { > +ink_atomic_swap<int64_t>(pvint64 mem, int64_t value) { > int64_t old; > ink_mutex_acquire(&__global_death); > old = *mem; > @@ -128,8 +137,10 @@ ink_atomic_swap64(pvint64 mem, int64_t value) { > ink_mutex_release(&__global_death); > return old; > } > + > +template<> > static inline int64_t > -ink_atomic_cas64(pvint64 mem, int64_t old, int64_t new_value) { > +ink_atomic_cas<int64_t>(pvint64 mem, int64_t old, int64_t new_value) { > int64_t curr; > ink_mutex_acquire(&__global_death); > curr = *mem; > @@ -138,8 +149,10 @@ ink_atomic_cas64(pvint64 mem, int64_t old, int64_t > new_value) { > if(old == curr) return 1; > return 0; > } > + > +template<> > static inline int64_t > -ink_atomic_increment64(pvint64 mem, int64_t value) { > +ink_atomic_increment<int64_t>(pvint64 mem, int64_t value) { > int64_t curr; > ink_mutex_acquire(&__global_death); > curr = *mem; > @@ -148,10 +161,6 @@ ink_atomic_increment64(pvint64 mem, int64_t value) { > return curr + value; > } > > -#else /* Intel 64-bit operations */ > -static inline int64_t ink_atomic_swap64(pvint64 mem, int64_t value) { return > __sync_lock_test_and_set(mem, value); } > -static inline int64_t ink_atomic_cas64(pvint64 mem, int64_t old, int64_t > new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); } > -static inline int64_t ink_atomic_increment64(pvint64 mem, int64_t value) { > return __sync_fetch_and_add(mem, value); } > #endif > > /* not used for Intel Processors which have sequential(esque) consistency */ > @@ -162,6 +171,4 @@ static inline int64_t ink_atomic_increment64(pvint64 mem, > int64_t value) { retur > #error Need a compiler / libc that supports atomic operations, e.g. gcc > v4.1.2 or later > #endif > > -#endif /* SunPRO CC */ > - > #endif /* _ink_atomic_h_ */ > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/lib/ts/ink_queue.cc > ---------------------------------------------------------------------- > diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc > index e9cc992..73435e0 100644 > --- a/lib/ts/ink_queue.cc > +++ b/lib/ts/ink_queue.cc > @@ -84,7 +84,7 @@ static ink_freelist_list *freelists = NULL; > inkcoreapi volatile int64_t freelist_allocated_mem = 0; > > #define fl_memadd(_x_) \ > - ink_atomic_increment64(&freelist_allocated_mem, (int64_t) (_x_)); > + ink_atomic_increment(&freelist_allocated_mem, (int64_t) (_x_)); > > > void > @@ -172,7 +172,7 @@ ink_freelist_new(InkFreeList * f) > SET_FREELIST_POINTER_VERSION(item, newp, 0); > > ink_atomic_increment((int *) &f->allocated, f->chunk_size); > - ink_atomic_increment64(&fastalloc_mem_total, (int64_t) f->chunk_size * > f->type_size); > + ink_atomic_increment(&fastalloc_mem_total, (int64_t) f->chunk_size * > f->type_size); > > /* free each of the new elements */ > for (i = 0; i < f->chunk_size; i++) { > @@ -193,12 +193,12 @@ ink_freelist_new(InkFreeList * f) > > } > ink_atomic_increment((int *) &f->count, f->chunk_size); > - ink_atomic_increment64(&fastalloc_mem_in_use, (int64_t) f->chunk_size > * f->type_size); > + ink_atomic_increment(&fastalloc_mem_in_use, (int64_t) f->chunk_size * > f->type_size); > > } else { > SET_FREELIST_POINTER_VERSION(next, > *ADDRESS_OF_NEXT(TO_PTR(FREELIST_POINTER(item)), f->offset), > FREELIST_VERSION(item) + 1); > - result = ink_atomic_cas64((int64_t *) & f->head.data, item.data, > next.data); > + result = ink_atomic_cas((int64_t *) & f->head.data, item.data, > next.data); > > #ifdef SANITY > if (result) { > @@ -217,7 +217,7 @@ ink_freelist_new(InkFreeList * f) > > ink_assert(!((uintptr_t)TO_PTR(FREELIST_POINTER(item))&(((uintptr_t)f->alignment)-1))); > > ink_atomic_increment((int *) &f->count, 1); > - ink_atomic_increment64(&fastalloc_mem_in_use, (int64_t) f->type_size); > + ink_atomic_increment(&fastalloc_mem_in_use, (int64_t) f->type_size); > > return TO_PTR(FREELIST_POINTER(item)); > #else // ! TS_USE_FREELIST > @@ -267,12 +267,12 @@ ink_freelist_free(InkFreeList * f, void *item) > *adr_of_next = FREELIST_POINTER(h); > SET_FREELIST_POINTER_VERSION(item_pair, FROM_PTR(item), > FREELIST_VERSION(h)); > INK_MEMORY_BARRIER; > - result = ink_atomic_cas64((int64_t *) & f->head, h.data, item_pair.data); > + result = ink_atomic_cas((int64_t *) & f->head, h.data, item_pair.data); > } > while (result == 0); > > ink_atomic_increment((int *) &f->count, -1); > - ink_atomic_increment64(&fastalloc_mem_in_use, -(int64_t) f->type_size); > + ink_atomic_increment(&fastalloc_mem_in_use, -(int64_t) f->type_size); > #else > if (f->alignment) > ats_memalign_free(item); > @@ -378,7 +378,7 @@ ink_atomiclist_pop(InkAtomicList * l) > SET_FREELIST_POINTER_VERSION(next, > *ADDRESS_OF_NEXT(TO_PTR(FREELIST_POINTER(item)), l->offset), > FREELIST_VERSION(item) + 1); > #if !defined(INK_USE_MUTEX_FOR_ATOMICLISTS) > - result = ink_atomic_cas64((int64_t *) & l->head.data, item.data, > next.data); > + result = ink_atomic_cas((int64_t *) & l->head.data, item.data, > next.data); > #else > l->head.data = next.data; > result = 1; > @@ -410,7 +410,7 @@ ink_atomiclist_popall(InkAtomicList * l) > return NULL; > SET_FREELIST_POINTER_VERSION(next, FROM_PTR(NULL), FREELIST_VERSION(item) > + 1); > #if !defined(INK_USE_MUTEX_FOR_ATOMICLISTS) > - result = ink_atomic_cas64((int64_t *) & l->head.data, item.data, > next.data); > + result = ink_atomic_cas((int64_t *) & l->head.data, item.data, > next.data); > #else > l->head.data = next.data; > result = 1; > @@ -453,7 +453,7 @@ ink_atomiclist_push(InkAtomicList * l, void *item) > SET_FREELIST_POINTER_VERSION(item_pair, FROM_PTR(item), > FREELIST_VERSION(head)); > INK_MEMORY_BARRIER; > #if !defined(INK_USE_MUTEX_FOR_ATOMICLISTS) > - result = ink_atomic_cas64((int64_t *) & l->head, head.data, > item_pair.data); > + result = ink_atomic_cas((int64_t *) & l->head, head.data, > item_pair.data); > #else > l->head.data = item_pair.data; > result = 1; > @@ -487,7 +487,7 @@ ink_atomiclist_remove(InkAtomicList * l, void *item) > head_p next; > SET_FREELIST_POINTER_VERSION(next, item_next, FREELIST_VERSION(head) + 1); > #if !defined(INK_USE_MUTEX_FOR_ATOMICLISTS) > - result = ink_atomic_cas64((int64_t *) & l->head.data, head.data, > next.data); > + result = ink_atomic_cas((int64_t *) & l->head.data, head.data, > next.data); > #else > l->head.data = next.data; > result = 1; > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/lib/ts/test_atomic.cc > ---------------------------------------------------------------------- > diff --git a/lib/ts/test_atomic.cc b/lib/ts/test_atomic.cc > index 26830ef..7a29c88 100644 > --- a/lib/ts/test_atomic.cc > +++ b/lib/ts/test_atomic.cc > @@ -159,11 +159,11 @@ main(int argc, const char *argv[]) > printf("changed to: %d, result=%s\n", m, n ? "true" : "false"); > > printf("CAS pointer: '%s' == 'hello' then 'new'\n", m2); > - n = ink_atomic_cas_ptr((pvvoidp) &m2, (char *) "hello", (char *) "new"); > + n = ink_atomic_cas( &m2, "hello", "new"); > printf("changed to: %s, result=%s\n", m2, n ? (char *) "true" : (char *) > "false"); > > printf("CAS pointer: '%s' == 'hello' then 'new2'\n", m2); > - n = ink_atomic_cas_ptr((pvvoidp)&m2, (char*)m2, (char *) "new2"); > + n = ink_atomic_cas(&m2, m2, "new2"); > printf("changed to: %s, result=%s\n", m2, n ? "true" : "false"); > > n = 100; > @@ -173,7 +173,7 @@ main(int argc, const char *argv[]) > > > printf("Atomic Fetch-and-Add 2 to pointer to '%s'\n", m2); > - n2 = (char *)ink_atomic_increment_ptr((pvvoidp)&m2, 2); > + n2 = (char *)ink_atomic_increment((pvvoidp)&m2, (void *)2); > printf("changed to: %s, result=%s\n", m2, n2); > > printf("Testing atomic lists\n"); > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/plugins/experimental/geoip_acl/lulu.h > ---------------------------------------------------------------------- > diff --git a/plugins/experimental/geoip_acl/lulu.h > b/plugins/experimental/geoip_acl/lulu.h > index 967057e..b6ba7bb 100644 > --- a/plugins/experimental/geoip_acl/lulu.h > +++ b/plugins/experimental/geoip_acl/lulu.h > @@ -71,14 +71,14 @@ typedef vvoidp *pvvoidp; > > /* see http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html */ > static inline int32 ink_atomic_swap(pvint32 mem, int32 value) { return > __sync_lock_test_and_set(mem, value); } > -static inline int64 ink_atomic_swap64(pvint64 mem, int64 value) { return > __sync_lock_test_and_set(mem, value); } > -static inline void *ink_atomic_swap_ptr(vvoidp mem, void *value) { return > __sync_lock_test_and_set((void**)mem, value); } > +static inline int64 ink_atomic_swap(pvint64 mem, int64 value) { return > __sync_lock_test_and_set(mem, value); } > +static inline void *ink_atomic_swap(vvoidp mem, void *value) { return > __sync_lock_test_and_set((void**)mem, value); } > static inline int ink_atomic_cas(pvint32 mem, int old, int new_value) { > return __sync_bool_compare_and_swap(mem, old, new_value); } > -static inline int64 ink_atomic_cas64(pvint64 mem, int64 old, int64 > new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); } > -static inline int ink_atomic_cas_ptr(pvvoidp mem, void* old, void* > new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); } > +static inline int64 ink_atomic_cas(pvint64 mem, int64 old, int64 new_value) > { return __sync_bool_compare_and_swap(mem, old, new_value); } > +static inline int ink_atomic_cas(pvvoidp mem, void* old, void* new_value) { > return __sync_bool_compare_and_swap(mem, old, new_value); } > static inline int ink_atomic_increment(pvint32 mem, int value) { return > __sync_fetch_and_add(mem, value); } > -static inline int64 ink_atomic_increment64(pvint64 mem, int64 value) { > return __sync_fetch_and_add(mem, value); } > -static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t value) { > return __sync_fetch_and_add((void**)mem, value); } > +static inline int64 ink_atomic_increment(pvint64 mem, int64 value) { return > __sync_fetch_and_add(mem, value); } > +static inline void *ink_atomic_increment(pvvoidp mem, intptr_t value) { > return __sync_fetch_and_add((void**)mem, value); } > #else > // TODO: Deal with this case? > #failure > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/AbstractBuffer.h > ---------------------------------------------------------------------- > diff --git a/proxy/AbstractBuffer.h b/proxy/AbstractBuffer.h > index fefa6fb..30e5b61 100644 > --- a/proxy/AbstractBuffer.h > +++ b/proxy/AbstractBuffer.h > @@ -174,7 +174,7 @@ private: > inline bool > AbstractBuffer::switch_state(VolatileState & old_vs, VolatileState & new_vs) > { > - if (ink_atomic_cas64((int64_t *) & vs.ival, old_vs.ival, new_vs.ival)) { > + if (ink_atomic_cas((int64_t *) & vs.ival, old_vs.ival, new_vs.ival)) { > return true; > } > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/CacheControl.cc > ---------------------------------------------------------------------- > diff --git a/proxy/CacheControl.cc b/proxy/CacheControl.cc > index 9e87e76..abbe7c4 100644 > --- a/proxy/CacheControl.cc > +++ b/proxy/CacheControl.cc > @@ -175,7 +175,7 @@ reloadCacheControl() > Debug("cache_control", "cache.config updated, reloading"); > eventProcessor.schedule_in(NEW(new > CC_FreerContinuation(CacheControlTable)), CACHE_CONTROL_TIMEOUT, ET_CACHE); > newTable = NEW(new CC_table("proxy.config.cache.control.filename", > modulePrefix, &http_dest_tags)); > - ink_atomic_swap_ptr(&CacheControlTable, newTable); > + ink_atomic_swap(&CacheControlTable, newTable); > } > > void > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/IPAllow.cc > ---------------------------------------------------------------------- > diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc > index 85985e7..ab2843b 100644 > --- a/proxy/IPAllow.cc > +++ b/proxy/IPAllow.cc > @@ -143,7 +143,7 @@ IpAllow::ReloadInstance() { > new_table = NEW(new self("proxy.config.cache.ip_allow.filename", "IpAllow", > "ip_allow")); > new_table->BuildTable(); > > - ink_atomic_swap_ptr(_instance, new_table); > + ink_atomic_swap(&_instance, new_table); > } > > // > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/ParentSelection.cc > ---------------------------------------------------------------------- > diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc > index 94bcec1..2fd86b4 100644 > --- a/proxy/ParentSelection.cc > +++ b/proxy/ParentSelection.cc > @@ -340,7 +340,7 @@ ParentConfigParams::recordRetrySuccess(ParentResult * > result) > ink_assert((int) (result->last_parent) < result->rec->num_parents); > pRec = result->rec->parents + result->last_parent; > > - ink_atomic_swap(&pRec->failedAt, 0); > + ink_atomic_swap(&pRec->failedAt, (time_t)0); > int old_count = ink_atomic_swap(&pRec->failCount, 0); > > if (old_count > 0) { > @@ -551,12 +551,12 @@ ParentRecord::FindParent(bool first_call, ParentResult > * result, RD * rdata, Par > if ((parents[cur_index].failedAt == 0) || (parents[cur_index].failCount < > config->FailThreshold)) { > Debug("parent_select", "config->FailThreshold = %d", > config->FailThreshold); > Debug("parent_select", "Selecting a down parent due to little failCount" > - "(faileAt: %u failCount: %d)", parents[cur_index].failedAt, > parents[cur_index].failCount); > + "(faileAt: %u failCount: %d)", > (unsigned)parents[cur_index].failedAt, parents[cur_index].failCount); > parentUp = true; > } else { > if ((result->wrap_around) || ((parents[cur_index].failedAt + > config->ParentRetryTime) < request_info->xact_start)) { > Debug("parent_select", "Parent[%d].failedAt = %u, retry = > %u,xact_start = %" PRId64 " but wrap = %d", cur_index, > - parents[cur_index].failedAt, config->ParentRetryTime, > (int64_t)request_info->xact_start, result->wrap_around); > + (unsigned)parents[cur_index].failedAt, > config->ParentRetryTime, (int64_t)request_info->xact_start, > result->wrap_around); > // Reuse the parent > parentUp = true; > parentRetry = true; > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/ParentSelection.h > ---------------------------------------------------------------------- > diff --git a/proxy/ParentSelection.h b/proxy/ParentSelection.h > index 427655e..a6f2d2a 100644 > --- a/proxy/ParentSelection.h > +++ b/proxy/ParentSelection.h > @@ -159,7 +159,7 @@ struct pRecord > { > char hostname[MAXDNAME + 1]; > int port; > - int32_t failedAt; > + time_t failedAt; > int failCount; > int32_t upAt; > const char *scheme; // for which parent matches (if any) > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/ProxyConfig.cc > ---------------------------------------------------------------------- > diff --git a/proxy/ProxyConfig.cc b/proxy/ProxyConfig.cc > index 2b2dd0a..593b0ae 100644 > --- a/proxy/ProxyConfig.cc > +++ b/proxy/ProxyConfig.cc > @@ -149,7 +149,7 @@ ConfigProcessor::set(unsigned int id, ConfigInfo * info) > > do { > old_info = (ConfigInfo *) infos[idx]; > - } while (!ink_atomic_cas_ptr((pvvoidp) & infos[idx], old_info, info)); > + } while (!ink_atomic_cas( & infos[idx], old_info, info)); > > if (old_info) { > eventProcessor.schedule_in(NEW(new ConfigInfoReleaser(id, old_info)), > HRTIME_SECONDS(60)); > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/ProxyConfig.h > ---------------------------------------------------------------------- > diff --git a/proxy/ProxyConfig.h b/proxy/ProxyConfig.h > index 550ccae..f7ad0ab 100644 > --- a/proxy/ProxyConfig.h > +++ b/proxy/ProxyConfig.h > @@ -74,8 +74,8 @@ public: > void release(unsigned int id, ConfigInfo * data); > > public: > - volatile ConfigInfo *infos[MAX_CONFIGS]; > - volatile int ninfos; > + ConfigInfo *infos[MAX_CONFIGS]; > + int ninfos; > }; > > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/ReverseProxy.cc > ---------------------------------------------------------------------- > diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc > index 185f3c5..84ef480 100644 > --- a/proxy/ReverseProxy.cc > +++ b/proxy/ReverseProxy.cc > @@ -191,7 +191,7 @@ reloadUrlRewrite() > if (newTable->is_valid()) { > eventProcessor.schedule_in(new UR_FreerContinuation(rewrite_table), > URL_REWRITE_TIMEOUT, ET_TASK); > Debug("url_rewrite", "remap.config done reloading!"); > - ink_atomic_swap_ptr(&rewrite_table, newTable); > + ink_atomic_swap(&rewrite_table, newTable); > } else { > static const char* msg = "failed to reload remap.config, not replacing!"; > delete newTable; > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/StatSystem.cc > ---------------------------------------------------------------------- > diff --git a/proxy/StatSystem.cc b/proxy/StatSystem.cc > index e643edc..e53617c 100644 > --- a/proxy/StatSystem.cc > +++ b/proxy/StatSystem.cc > @@ -522,7 +522,7 @@ initialize_all_global_stats() > > // TODO: HMMMM, wtf does this do? The following is that this > // function does: > - // ink_atomic_swap_ptr(&this->f_update_lock, (void *) func) > + // ink_atomic_swap(&this->f_update_lock, (void *) func) > // > // pmgmt->record_data->registerUpdateLockFunc(tmp_stats_lock_function); > > @@ -577,7 +577,7 @@ dyn_stats_count_cb(void *data, void *res) > READ_DYN_STAT((long) data, count, sum); > NOWARN_UNUSED(sum); > //*(ink_statval_t *)res = count; > - ink_atomic_swap64((ink_statval_t *) res, count); > + ink_atomic_swap((ink_statval_t *) res, count); > return res; > } > > @@ -588,7 +588,7 @@ dyn_stats_sum_cb(void *data, void *res) > READ_DYN_STAT((long) data, count, sum); > NOWARN_UNUSED(count); > //*(ink_statval_t *)res = sum; > - ink_atomic_swap64((ink_statval_t *) res, sum); > + ink_atomic_swap((ink_statval_t *) res, sum); > return res; > } > > @@ -702,7 +702,7 @@ http_trans_stats_count_cb(void *data, void *res) > READ_HTTP_TRANS_STAT((long) data, count, sum); > NOWARN_UNUSED(sum); > //*(ink_statval_t *)res = count; > - ink_atomic_swap64((ink_statval_t *) res, count); > + ink_atomic_swap((ink_statval_t *) res, count); > return res; > } > > @@ -713,7 +713,7 @@ http_trans_stats_sum_cb(void *data, void *res) > READ_HTTP_TRANS_STAT((long) data, count, sum); > NOWARN_UNUSED(count); > //*(ink_statval_t *)res = sum; > - ink_atomic_swap64((ink_statval_t *) res, sum); > + ink_atomic_swap((ink_statval_t *) res, sum); > return res; > } > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/StatSystem.h > ---------------------------------------------------------------------- > diff --git a/proxy/StatSystem.h b/proxy/StatSystem.h > index ccfff96..6d56797 100644 > --- a/proxy/StatSystem.h > +++ b/proxy/StatSystem.h > @@ -389,8 +389,8 @@ mutex->thread_holding->global_dyn_stats[X].count ++; \ > mutex->thread_holding->global_dyn_stats[X].sum += (S) > > #define ADD_TO_GLOBAL_GLOBAL_DYN_SUM(X,S) \ > -ink_atomic_increment64(&global_dyn_stats[X].count,(ink_statval_t)1); \ > -ink_atomic_increment64(&global_dyn_stats[X].sum,S) > +ink_atomic_increment(&global_dyn_stats[X].count,(ink_statval_t)1); \ > +ink_atomic_increment(&global_dyn_stats[X].sum,S) > /* > * global_dyn_stats[X].count ++; \ > * global_dyn_stats[X].sum += (S) > @@ -450,18 +450,18 @@ global_dyn_stats[X].sum = S > #else > > #define ADD_TO_GLOBAL_DYN_COUNT(X,C) \ > -ink_atomic_increment64(&global_dyn_stats[X].count,C) > +ink_atomic_increment(&global_dyn_stats[X].count,C) > > #define ADD_TO_GLOBAL_DYN_SUM(X,S) \ > -ink_atomic_increment64(&global_dyn_stats[X].count,(ink_statval_t)1); \ > -ink_atomic_increment64(&global_dyn_stats[X].sum,S) > +ink_atomic_increment(&global_dyn_stats[X].count,(ink_statval_t)1); \ > +ink_atomic_increment(&global_dyn_stats[X].sum,S) > > #define ADD_TO_GLOBAL_GLOBAL_DYN_SUM(X,S) \ > -ink_atomic_increment64(&global_dyn_stats[X].count,(ink_statval_t)1); \ > -ink_atomic_increment64(&global_dyn_stats[X].sum,S) > +ink_atomic_increment(&global_dyn_stats[X].count,(ink_statval_t)1); \ > +ink_atomic_increment(&global_dyn_stats[X].sum,S) > > #define ADD_TO_GLOBAL_DYN_FSUM(X,S) \ > -ink_atomic_increment64(&global_dyn_stats[X].count,(ink_statval_t)1); \ > +ink_atomic_increment(&global_dyn_stats[X].count,(ink_statval_t)1); \ > (*(double *)&global_dyn_stats[X].sum) += S > > #define CLEAR_GLOBAL_DYN_STAT(X) \ > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/congest/Congestion.cc > ---------------------------------------------------------------------- > diff --git a/proxy/congest/Congestion.cc b/proxy/congest/Congestion.cc > index 3cb2ed8..9552217 100644 > --- a/proxy/congest/Congestion.cc > +++ b/proxy/congest/Congestion.cc > @@ -433,7 +433,7 @@ reloadCongestionControl() > newTable->Print(); > #endif > new_Deleter(CongestionMatcher, t); > - ink_atomic_swap_ptr(&CongestionMatcher, newTable); > + ink_atomic_swap(&CongestionMatcher, newTable); > if (congestionControlEnabled) { > revalidateCongestionDB(); > } > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/http/HttpClientSession.cc > ---------------------------------------------------------------------- > diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc > index ae6652a..7ca304c 100644 > --- a/proxy/http/HttpClientSession.cc > +++ b/proxy/http/HttpClientSession.cc > @@ -195,7 +195,7 @@ HttpClientSession::new_connection(NetVConnection * > new_vc, bool backdoor) > this->backdoor_connect = backdoor; > > // Unique client session identifier. > - con_id = ink_atomic_increment64((int64_t *) (&next_cs_id), 1); > + con_id = ink_atomic_increment((int64_t *) (&next_cs_id), 1); > > HTTP_INCREMENT_DYN_STAT(http_current_client_connections_stat); > conn_decrease = true; > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/http/HttpServerSession.cc > ---------------------------------------------------------------------- > diff --git a/proxy/http/HttpServerSession.cc b/proxy/http/HttpServerSession.cc > index 5ff532e..7898c09 100644 > --- a/proxy/http/HttpServerSession.cc > +++ b/proxy/http/HttpServerSession.cc > @@ -67,7 +67,7 @@ HttpServerSession::new_connection(NetVConnection *new_vc) > mutex = new_vc->mutex; > > // Unique client session identifier. > - con_id = ink_atomic_increment64((int64_t *) (&next_ss_id), 1); > + con_id = ink_atomic_increment((int64_t *) (&next_ss_id), 1); > > magic = HTTP_SS_MAGIC_ALIVE; > HTTP_SUM_GLOBAL_DYN_STAT(http_current_server_connections_stat, 1); // > Update the true global stat > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/http/HttpTransact.cc > ---------------------------------------------------------------------- > diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc > index 4d34b01..1d524c9 100644 > --- a/proxy/http/HttpTransact.cc > +++ b/proxy/http/HttpTransact.cc > @@ -8345,13 +8345,8 @@ ink_cluster_time(void) > old = global_time; > > while (local_time > global_time) { > - if (sizeof(ink_time_t) == 4) { > - if (ink_atomic_cas((int32_t *) & global_time, *((int32_t *) & old), > *((int32_t *) & local_time))) > - break; > - } else if (sizeof(ink_time_t) == 8) { > - if (ink_atomic_cas64((int64_t *) & global_time, *((int64_t *) & old), > *((int64_t *) & local_time))) > - break; > - } > + if (ink_atomic_cas(&global_time, old, local_time)) > + break; > old = global_time; > } > > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/logging/Log.cc > ---------------------------------------------------------------------- > diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc > index 9b06b63..14f734a 100644 > --- a/proxy/logging/Log.cc > +++ b/proxy/logging/Log.cc > @@ -124,7 +124,7 @@ Log::change_configuration() > > // Swap in the new config object > // > - ink_atomic_swap_ptr((void *) &Log::config, new_config); > + ink_atomic_swap(&Log::config, new_config); > > // Force new buffers for inactive objects > // > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/logging/LogBuffer.h > ---------------------------------------------------------------------- > diff --git a/proxy/logging/LogBuffer.h b/proxy/logging/LogBuffer.h > index 279e69c..42b1aa6 100644 > --- a/proxy/logging/LogBuffer.h > +++ b/proxy/logging/LogBuffer.h > @@ -158,7 +158,7 @@ public: > int switch_state(LB_State & old_state, LB_State & new_state) > { > INK_WRITE_MEMORY_BARRIER; > - return (ink_atomic_cas64((int64_t *) & m_state.ival, old_state.ival, > new_state.ival)); > + return (ink_atomic_cas( & m_state.ival, old_state.ival, new_state.ival)); > }; > > LB_ResultCode checkout_write(size_t * write_offset, size_t write_size); > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/logging/LogConfig.cc > ---------------------------------------------------------------------- > diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc > index 94160c4..5e2168b 100644 > --- a/proxy/logging/LogConfig.cc > +++ b/proxy/logging/LogConfig.cc > @@ -760,7 +760,7 @@ LogConfig::init(LogConfig * prev_config) > new_elog = 0; > } > } > - ink_atomic_swap_ptr((void *) &Log::error_log, new_elog); > + ink_atomic_swap(&Log::error_log, new_elog); > if (old_elog) { > old_elog->force_new_buffer(); > Log::add_to_inactive(old_elog); > > http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76aa879d/proxy/logging/LogObject.cc > ---------------------------------------------------------------------- > diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc > index 2e21f7b..e2e6aec 100644 > --- a/proxy/logging/LogObject.cc > +++ b/proxy/logging/LogObject.cc > @@ -418,7 +418,7 @@ LogObject::_checkout_write(size_t * write_offset, size_t > bytes_needed) { > INK_QUEUE_LD64(h, m_log_buffer); > head_p new_h; > SET_FREELIST_POINTER_VERSION(new_h, FREELIST_POINTER(h), > FREELIST_VERSION(h) + 1); > - result = ink_atomic_cas64((int64_t*)&m_log_buffer.data, h.data, > new_h.data); > + result = ink_atomic_cas((int64_t*)&m_log_buffer.data, h.data, > new_h.data); > } while (!result); > buffer = (LogBuffer*)FREELIST_POINTER(h); > result_code = buffer->checkout_write(write_offset, bytes_needed); > @@ -443,7 +443,7 @@ LogObject::_checkout_write(size_t * write_offset, size_t > bytes_needed) { > INK_QUEUE_LD64(old_h, m_log_buffer); > head_p tmp_h; > SET_FREELIST_POINTER_VERSION(tmp_h, new_buffer, 0); > - result = ink_atomic_cas64((int64_t*)&m_log_buffer.data, old_h.data, > tmp_h.data); > + result = ink_atomic_cas((int64_t*)&m_log_buffer.data, old_h.data, > tmp_h.data); > } while (!result); > if (FREELIST_POINTER(old_h) == FREELIST_POINTER(h)) > ink_atomic_increment(&buffer->m_references, FREELIST_VERSION(old_h) - > 1); > @@ -483,7 +483,7 @@ LogObject::_checkout_write(size_t * write_offset, size_t > bytes_needed) { > break; > head_p tmp_h; > SET_FREELIST_POINTER_VERSION(tmp_h, FREELIST_POINTER(h), > FREELIST_VERSION(old_h) - 1); > - result = ink_atomic_cas64((int64_t*)&m_log_buffer.data, old_h.data, > tmp_h.data); > + result = ink_atomic_cas((int64_t*)&m_log_buffer.data, old_h.data, > tmp_h.data); > } while (!result); > if (FREELIST_POINTER(old_h) != FREELIST_POINTER(h)) > ink_atomic_increment(&buffer->m_references, -1); >