You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by mt...@apache.org on 2010/05/18 18:42:19 UTC
svn commit: r945738 - in /trafficserver/traffic/trunk:
librecords/Makefile.am librecords/P_RecDefs.h librecords/RecCore.cc
librecords/RecMessage.cc proxy/mgmt2/LocalManager.cc
Author: mturk
Date: Tue May 18 16:42:19 2010
New Revision: 945738
URL: http://svn.apache.org/viewvc?rev=945738&view=rev
Log:
Remove hard coded paths from librecords
Modified:
trafficserver/traffic/trunk/librecords/Makefile.am
trafficserver/traffic/trunk/librecords/P_RecDefs.h
trafficserver/traffic/trunk/librecords/RecCore.cc
trafficserver/traffic/trunk/librecords/RecMessage.cc
trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc
Modified: trafficserver/traffic/trunk/librecords/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/librecords/Makefile.am?rev=945738&r1=945737&r2=945738&view=diff
==============================================================================
--- trafficserver/traffic/trunk/librecords/Makefile.am (original)
+++ trafficserver/traffic/trunk/librecords/Makefile.am Tue May 18 16:42:19 2010
@@ -37,9 +37,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/proxy/http2 \
-I$(top_srcdir)/proxy/hdrs \
-I$(top_srcdir)/proxy \
- -I$(top_srcdir)/libinktomi++ \
- -DPKGLOCALSTATEDIR=\"$(pkglocalstatedir)\" \
- -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
+ -I$(top_srcdir)/libinktomi++
noinst_LIBRARIES = libreclocal.a librecprocess.a
Modified: trafficserver/traffic/trunk/librecords/P_RecDefs.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/librecords/P_RecDefs.h?rev=945738&r1=945737&r2=945738&view=diff
==============================================================================
--- trafficserver/traffic/trunk/librecords/P_RecDefs.h (original)
+++ trafficserver/traffic/trunk/librecords/P_RecDefs.h Tue May 18 16:42:19 2010
@@ -28,13 +28,9 @@
#include "I_RecDefs.h"
-#define REC_CONFIG_DIR "./etc/trafficserver/"
#define REC_CONFIG_FILE "records.config"
#define REC_SHADOW_EXT ".shadow"
-#define REC_RAW_STATS_DIR "./var/trafficserver/"
#define REC_RAW_STATS_FILE "records.snap"
-
-#define REC_PIPE_DIR "./var/trafficserver"
#define REC_PIPE_NAME "librecords_pipe"
#define REC_MESSAGE_ELE_MAGIC 0xF00DF00D
Modified: trafficserver/traffic/trunk/librecords/RecCore.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/librecords/RecCore.cc?rev=945738&r1=945737&r2=945738&view=diff
==============================================================================
--- trafficserver/traffic/trunk/librecords/RecCore.cc (original)
+++ trafficserver/traffic/trunk/librecords/RecCore.cc Tue May 18 16:42:19 2010
@@ -27,6 +27,7 @@
#include "P_RecCore.h"
#include "P_RecUtils.h"
#include "P_RecTree.h"
+#include "I_Layout.h"
static bool g_initialized = false;
@@ -209,7 +210,7 @@ RecCoreInit(RecModeT mode_type, Diags *_
}
// read stats
if ((mode_type == RECM_SERVER) || (mode_type == RECM_STAND_ALONE)) {
- g_stats_snap_fpath = REC_RAW_STATS_DIR REC_RAW_STATS_FILE;
+ g_stats_snap_fpath = Layout::relative_to(Layout::get()->runtimedir, REC_RAW_STATS_FILE);
RecReadStatsFile();
}
// read configs
@@ -223,18 +224,14 @@ RecCoreInit(RecModeT mode_type, Diags *_
// ./etc/trafficserver/records.config
// ./records.config
bool file_exists = true;
- g_rec_config_fpath = REC_CONFIG_DIR REC_CONFIG_FILE REC_SHADOW_EXT;
+ g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir,
+ REC_CONFIG_FILE REC_SHADOW_EXT);
if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
- g_rec_config_fpath = REC_CONFIG_FILE REC_SHADOW_EXT;
+ g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir,
+ REC_CONFIG_FILE);
if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
- g_rec_config_fpath = REC_CONFIG_DIR REC_CONFIG_FILE;
- if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
- g_rec_config_fpath = REC_CONFIG_FILE;
- if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
- RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", REC_CONFIG_FILE);
- file_exists = false;
- }
- }
+ RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", REC_CONFIG_FILE);
+ file_exists = false;
}
}
if (file_exists) {
Modified: trafficserver/traffic/trunk/librecords/RecMessage.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/librecords/RecMessage.cc?rev=945738&r1=945737&r2=945738&view=diff
==============================================================================
--- trafficserver/traffic/trunk/librecords/RecMessage.cc (original)
+++ trafficserver/traffic/trunk/librecords/RecMessage.cc Tue May 18 16:42:19 2010
@@ -26,6 +26,7 @@
#include "P_RecCompatibility.h"
#include "P_RecMessage.h"
#include "P_RecUtils.h"
+#include "I_Layout.h"
static bool g_message_initialized = false;
static RecMessageRecvCb g_recv_cb = NULL;
@@ -99,7 +100,7 @@ accept_thr(void *data)
{
REC_NOWARN_UNUSED(data);
RecHandle h_pipe;
- h_pipe = RecPipeCreate(REC_PIPE_DIR, REC_PIPE_NAME);
+ h_pipe = RecPipeCreate(Layout::get()->runtimedir, REC_PIPE_NAME);
ink_thread_create(send_thr, (void *) h_pipe);
ink_thread_create(recv_thr, (void *) h_pipe);
return NULL;
Modified: trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc?rev=945738&r1=945737&r2=945738&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/LocalManager.cc Tue May 18 16:42:19 2010
@@ -33,7 +33,7 @@
#include "inktomi++.h"
#include "ink_platform.h"
#include "ink_unused.h" /* MAGIC_EDITING_TAG */
-
+#include "I_Layout.h"
#include "Compatability.h"
#include "LocalManager.h"
#include "NTDefs.h"
@@ -144,7 +144,7 @@ char snap_filename[FILE_NAME_MAX+1] = "s
void
LocalManager::clearStats()
{
- const char *statsPath;
+ char *statsPath;
char local_state_dir[FILE_NAME_MAX];
char snap_file[FILE_NAME_MAX];
struct stat s;
@@ -177,12 +177,13 @@ LocalManager::clearStats()
// that operation works even when the proxy is off
//
if (this->proxy_running == 0) {
- statsPath = REC_RAW_STATS_DIR REC_RAW_STATS_FILE;
+ statsPath = Layout::relative_to(Layout::get()->runtimedir, REC_RAW_STATS_FILE);
if (unlink(statsPath) < 0) {
if (errno != ENOENT) {
mgmt_log(stderr, "[LocalManager::clearStats] Unlink of %s failed : %s\n", REC_RAW_STATS_FILE, strerror(errno));
}
}
+ xfree(statsPath);
}
} /* End LocalManager::clearStats */