You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2012/03/08 18:02:43 UTC
git commit: TS-1124 Try to fix regex_remap to build on Solaris, try 1
Updated Branches:
refs/heads/master fd372c9cd -> 0306f0acb
TS-1124 Try to fix regex_remap to build on Solaris, try 1
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0306f0ac
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0306f0ac
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0306f0ac
Branch: refs/heads/master
Commit: 0306f0acb89df1265a0bfc10da06f6613f0bdc36
Parents: fd372c9
Author: Leif Hedstrom <le...@ogre.com>
Authored: Thu Mar 8 10:02:32 2012 -0700
Committer: Leif Hedstrom <le...@ogre.com>
Committed: Thu Mar 8 10:02:32 2012 -0700
----------------------------------------------------------------------
plugins/regex_remap/regex_remap.cc | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0306f0ac/plugins/regex_remap/regex_remap.cc
----------------------------------------------------------------------
diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc
index 9fd8e80..0429960 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -24,6 +24,10 @@
#define UNUSED __attribute__ ((unused))
static char UNUSED rcsId__regex_remap_cc[] = "@(#) $Id$ built on " __DATE__ " " __TIME__;
+#if defined(solaris)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+
#include <sys/types.h>
#include <stdio.h>
#include <time.h>
@@ -39,19 +43,23 @@ static char UNUSED rcsId__regex_remap_cc[] = "@(#) $Id$ built on " __DATE__ " "
#include <fstream>
#include <string>
-
static const char* PLUGIN_NAME = "regex_remap";
-// This is copied from lib/ts/*.h, only works with gcc 4.x or later (and compatible).
// TODO: We really ought to expose these data types and atomic functions to the plugin APIs.
-typedef int int32;
-typedef volatile int32 vint32;
+typedef volatile int32_t vint32;
typedef vint32 *pvint32;
+#if defined(__SUNPRO_CC)
+static inline int atomic_increment(pvint32 mem, int value)
+{
+ return ((uint32_t)atomic_add_32_nv((pvuint32)mem, (uint32_t)value)) - value;
+}
+#else
static inline int atomic_increment(pvint32 mem, int value)
{
return __sync_fetch_and_add(mem, value);
}
+#endif
// Constants
@@ -705,7 +713,7 @@ TSRemapDeleteInstance(void* ih)
if (ri->profile) {
char now[64];
- time_t tim = time(NULL);
+ const time_t tim = time(NULL);
if (ctime_r(&tim, now))
now[strlen(now) - 1] = '\0';