You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/12/06 05:35:41 UTC
[07/11] git commit: TS-2401: Remove global system_runtime_dir
TS-2401: Remove global system_runtime_dir
Introduce RecConfigReadRuntimeDir() to centralize overriding
Layout::runtimedir with proxy.config.local_state_dir. Use this to
replace all the instances of system_runtime_dir.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f438ab45
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f438ab45
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f438ab45
Branch: refs/heads/master
Commit: f438ab45e6c467a6e4fbb595c0547a06e91715d3
Parents: 88f5176
Author: James Peach <jp...@apache.org>
Authored: Wed Nov 27 21:24:28 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:49 2013 -0800
----------------------------------------------------------------------
cmd/traffic_cop/traffic_cop.cc | 16 +++++++++-
example/app-template/app-template.cc | 2 --
iocore/hostdb/HostDB.cc | 31 +++++++++++--------
iocore/hostdb/MultiCache.cc | 6 ++--
lib/records/I_RecCore.h | 4 +++
lib/records/I_RecDefs.h | 2 --
lib/records/RecConfigParse.cc | 1 +
lib/records/RecCore.cc | 16 ++++++++++
mgmt/LocalManager.cc | 5 +++-
mgmt/Main.cc | 8 ++---
mgmt/ProcessManager.cc | 4 ++-
mgmt/web2/WebIntrMain.cc | 5 ++--
proxy/Main.cc | 49 +++++++++++++------------------
proxy/StatSystem.cc | 20 ++++---------
proxy/logging/LogStandalone.cc | 1 -
15 files changed, 97 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/cmd/traffic_cop/traffic_cop.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 7a258b8..564f070 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -542,6 +542,20 @@ ConfigIntFatalError:
exit(1);
}
+static const char *
+config_read_runtime_dir()
+{
+ char state_dir[PATH_NAME_MAX + 1];
+
+ state_dir[0] = '\0';
+ config_read_string("proxy.config.local_state_dir", state_dir, sizeof(state_dir), true);
+ if (strlen(state_dir) > 0) {
+ return Layout::get()->relative(state_dir);
+ } else {
+ return ats_strdup(Layout::get()->runtimedir);
+ }
+}
+
static void
config_reload_records()
{
@@ -1700,7 +1714,7 @@ init_config_dir()
cop_log_trace("Entering init_config_dir()\n");
root_dir = Layout::get()->prefix;
- runtime_dir = Layout::get()->runtimedir;
+ runtime_dir = config_read_runtime_dir();
config_dir = Layout::get()->sysconfdir;
if (chdir(root_dir) < 0) {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/example/app-template/app-template.cc
----------------------------------------------------------------------
diff --git a/example/app-template/app-template.cc b/example/app-template/app-template.cc
index 5f8cb6d..af23b2b 100644
--- a/example/app-template/app-template.cc
+++ b/example/app-template/app-template.cc
@@ -53,7 +53,6 @@ int system_num_of_processors = ink_number_of_processors();
int system_num_of_net_threads = DEFAULT_NUMBER_OF_THREADS;
int system_num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS;
-char system_runtime_dir[PATH_NAME_MAX + 1];
char system_config_directory[PATH_NAME_MAX + 1];
//int system_remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
@@ -157,7 +156,6 @@ int main(int argc, char * argv[])
// Get TS directories
ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, sizeof(system_config_directory));
- ink_strlcpy(system_runtime_dir, Layout::get()->runtimedir, sizeof(system_runtime_dir));
if (chdir(Layout::get()->prefix) < 0) {
fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", Layout::get()->prefix, errno, strerror(errno));
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 0ffd5bc..e0fe928 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -380,6 +380,8 @@ HostDBCache::start(int flags)
bool reconfigure = ((flags & PROCESSOR_RECONFIGURE) ? true : false);
bool fix = ((flags & PROCESSOR_FIX) ? true : false);
+ storage_path[0] = '\0';
+
// Read configuration
// Command line overrides manager configuration.
//
@@ -390,20 +392,22 @@ HostDBCache::start(int flags)
REC_ReadConfigString(storage_path, "proxy.config.hostdb.storage_path", PATH_NAME_MAX);
REC_ReadConfigInt32(storage_size, "proxy.config.hostdb.storage_size");
- if (storage_path[0] != '/') {
- Layout::relative_to(storage_path, PATH_NAME_MAX, Layout::get()->prefix, storage_path);
+ // If proxy.config.hostdb.storage_path is not set, use the local state dir. If it is set to
+ // a relative path, make it relative to the prefix.
+ if (storage_path[0] == '\0') {
+ xptr<char> rundir(RecConfigReadRuntimeDir());
+ ink_strlcpy(storage_path, rundir, sizeof(storage_path));
+ } else if (storage_path[0] != '/') {
+ Layout::relative_to(storage_path, sizeof(storage_path), Layout::get()->prefix, storage_path);
}
Debug("hostdb", "Storage path is %s", storage_path);
- // XXX: Should this be W_OK?
- if (access(storage_path, R_OK) == -1) {
- ink_strlcpy(storage_path, system_runtime_dir, sizeof(storage_path));
- if (access(storage_path, R_OK) == -1) {
- Warning("Unable to access() directory '%s': %d, %s", storage_path, errno, strerror(errno));
- Warning(" Please set 'proxy.config.hostdb.storage_path' or 'proxy.config.local_state_dir' ");
- }
+ if (access(storage_path, W_OK | R_OK) == -1) {
+ Warning("Unable to access() directory '%s': %d, %s", storage_path, errno, strerror(errno));
+ Warning("Please set 'proxy.config.hostdb.storage_path' or 'proxy.config.local_state_dir'");
}
+
hostDBStore = NEW(new Store);
hostDBSpan = NEW(new Span);
hostDBSpan->init(storage_path, storage_size);
@@ -411,12 +415,13 @@ HostDBCache::start(int flags)
Debug("hostdb", "Opening %s, size=%d", hostdb_filename, hostdb_size);
if (open(hostDBStore, "hostdb.config", hostdb_filename, hostdb_size, reconfigure, fix, false /* slient */ ) < 0) {
+ xptr<char> rundir(RecConfigReadRuntimeDir());
+ xptr<char> config(Layout::relative_to(rundir, "hostdb.config"));
+
Note("reconfiguring host database");
- char p[PATH_NAME_MAX + 1];
- Layout::relative_to(p, PATH_NAME_MAX, system_runtime_dir, "hostdb.config");
- if (unlink(p) < 0)
- Debug("hostdb", "unable to unlink %s", p);
+ if (unlink(config) < 0)
+ Debug("hostdb", "unable to unlink %s", (const char *)config);
delete hostDBStore;
hostDBStore = NEW(new Store);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/iocore/hostdb/MultiCache.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc
index bd0fdb0..b153d75 100644
--- a/iocore/hostdb/MultiCache.cc
+++ b/iocore/hostdb/MultiCache.cc
@@ -501,9 +501,10 @@ int
MultiCacheBase::read_config(const char *config_filename, Store & s, char *fn, int *pi, int *pbuck)
{
int scratch;
+ xptr<char> rundir(RecConfigReadRuntimeDir());
char p[PATH_NAME_MAX + 1], buf[256];
- Layout::relative_to(p, sizeof(p), system_runtime_dir, config_filename);
+ Layout::relative_to(p, sizeof(p), rundir, config_filename);
int fd =::open(p, O_RDONLY);
if (fd < 0)
@@ -537,10 +538,11 @@ MultiCacheBase::read_config(const char *config_filename, Store & s, char *fn, in
int
MultiCacheBase::write_config(const char *config_filename, int nominal_size, int abuckets)
{
+ xptr<char> rundir(RecConfigReadRuntimeDir());
char p[PATH_NAME_MAX + 1], buf[256];
int fd, retcode = -1;
- Layout::relative_to(p, sizeof(p), system_runtime_dir, config_filename);
+ Layout::relative_to(p, sizeof(p), rundir, config_filename);
// XXX: Shouldn't that be 0664?
//
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/I_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h
index dda8f44..86f6595 100644
--- a/lib/records/I_RecCore.h
+++ b/lib/records/I_RecCore.h
@@ -45,6 +45,10 @@ typedef void (*RecConfigEntryCallback)(RecT rec_type, RecDataT data_type, const
void RecConfigFileInit(void);
int RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_version);
+// Return a copy of the system's local state directory, taking proxy.config.local_state_dir into account. The
+// caller MUST releease the result with ats_free().
+char * RecConfigReadRuntimeDir();
+
// Test whether the named configuration value is overridden by an environment variable. Return either
// the overridden value, or the original value. Caller MUST NOT free the result.
const char * RecConfigOverrideFromEnvironment(const char * name, const char * value);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index 302b3c9..928a5ac 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -175,9 +175,7 @@ typedef int (*RecRawStatSyncCb) (const char *name, RecDataT data_type, RecData *
#define REC_VAR_NAME_DELIMITOR '.'
#define REC_VAR_NAME_WILDCARD '*'
-
// System Defaults
-extern char system_runtime_dir[PATH_NAME_MAX + 1];
extern char system_config_directory[PATH_NAME_MAX + 1];
#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/RecConfigParse.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecConfigParse.cc b/lib/records/RecConfigParse.cc
index 0ab0726..21319b4 100644
--- a/lib/records/RecConfigParse.cc
+++ b/lib/records/RecConfigParse.cc
@@ -30,6 +30,7 @@
#include "P_RecUtils.h"
#include "P_RecMessage.h"
#include "P_RecCore.h"
+#include "I_Layout.h"
const char *g_rec_config_fpath = NULL;
LLQ *g_rec_config_contents_llq = NULL;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 0aee4bd..50485fa 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -1053,6 +1053,22 @@ REC_readString(const char *name, bool * found, bool lock)
return _tmp;
}
+//-------------------------------------------------------------------------
+// RecConfigReadRuntimeDir
+//-------------------------------------------------------------------------
+char *
+RecConfigReadRuntimeDir()
+{
+ char buf[PATH_NAME_MAX + 1];
+
+ buf[0] = '\0';
+ RecGetRecordString("proxy.config.local_state_dir", buf, PATH_NAME_MAX);
+ if (strlen(buf) > 0) {
+ return Layout::get()->relative(buf);
+ } else {
+ return ats_strdup(Layout::get()->runtimedir);
+ }
+}
//-------------------------------------------------------------------------
// REC_SignalManager (TS)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 12adb34..4572b57 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -204,6 +204,8 @@ LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on)
: BaseManager(), run_proxy(proxy_on)
{
bool found;
+ xptr<char> rundir(RecConfigReadRuntimeDir());
+
#ifdef MGMT_USE_SYSLOG
syslog_facility = 0;
#endif
@@ -221,7 +223,8 @@ LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on)
mgmt_log("Bad or missing proxy.config.lm.sem_id value; using default id %d\n", MGMT_SEMID_DEFAULT);
mgmt_sync_key = MGMT_SEMID_DEFAULT;
}
- ink_strlcpy(pserver_path, system_runtime_dir, sizeof(pserver_path));
+
+ ink_strlcpy(pserver_path, rundir, sizeof(pserver_path));
virt_map = NULL;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index c8e1a33..c33f564 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -78,7 +78,6 @@ static char action_tags[1024] = "";
static bool proxy_on = true;
// TODO: Check if really need those
-char system_runtime_dir[PATH_NAME_MAX + 1];
char system_config_directory[PATH_NAME_MAX + 1];
char mgmt_path[PATH_NAME_MAX + 1];
@@ -267,6 +266,7 @@ setup_coredump()
static void
init_dirs()
{
+ xptr<char> rundir(RecConfigReadRuntimeDir());
char buf[PATH_NAME_MAX + 1];
REC_ReadConfigString(buf, "proxy.config.config_dir", PATH_NAME_MAX);
@@ -279,10 +279,8 @@ init_dirs()
ink_strlcpy(mgmt_path, system_config_directory, sizeof(mgmt_path));
- REC_ReadConfigString(buf, "proxy.config.local_state_dir", PATH_NAME_MAX);
- Layout::get()->relative(system_runtime_dir, PATH_NAME_MAX, buf);
- if (access(system_runtime_dir, R_OK) == -1) {
- mgmt_elog(0, "unable to access() local state dir '%s': %d, %s\n", system_runtime_dir, errno, strerror(errno));
+ if (access(rundir, R_OK) == -1) {
+ mgmt_elog(0, "unable to access() local state dir '%s': %d, %s\n", (const char *)rundir, errno, strerror(errno));
mgmt_elog(0, "please set 'proxy.config.local_state_dir'\n");
_exit(1);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/ProcessManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc
index 6e69f96..35bbae6 100644
--- a/mgmt/ProcessManager.cc
+++ b/mgmt/ProcessManager.cc
@@ -69,7 +69,9 @@ startProcessManager(void *arg)
ProcessManager::ProcessManager(bool rlm):
BaseManager(), require_lm(rlm), mgmt_sync_key(0), local_manager_sockfd(0), cbtable(NULL)
{
- ink_strlcpy(pserver_path, Layout::get()->runtimedir, sizeof(pserver_path));
+ xptr<char> rundir(RecConfigReadRuntimeDir());
+
+ ink_strlcpy(pserver_path, rundir, sizeof(pserver_path));
mgmt_signal_queue = create_queue();
// Set temp. process/manager timeout. Will be reconfigure later.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/web2/WebIntrMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebIntrMain.cc b/mgmt/web2/WebIntrMain.cc
index ff29c97..c3a6732 100644
--- a/mgmt/web2/WebIntrMain.cc
+++ b/mgmt/web2/WebIntrMain.cc
@@ -432,11 +432,12 @@ webIntr_main(void *)
// set up socket paths;
char api_sock_path[1024];
char event_sock_path[1024];
+ xptr<char> rundir(RecConfigReadRuntimeDir());
bzero(api_sock_path, 1024);
bzero(event_sock_path, 1024);
- snprintf(api_sock_path, sizeof(api_sock_path), "%s/mgmtapisocket", system_runtime_dir);
- snprintf(event_sock_path, sizeof(event_sock_path), "%s/eventapisocket", system_runtime_dir);
+ snprintf(api_sock_path, sizeof(api_sock_path), "%s/mgmtapisocket", (const char *)rundir);
+ snprintf(event_sock_path, sizeof(event_sock_path), "%s/eventapisocket", (const char *)rundir);
// INKqa12562: MgmtAPI sockets should be created with 775 permission
mode_t oldmask = umask(S_IWOTH);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index ec75cef..2f3e19e 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -144,7 +144,6 @@ char cluster_host[MAXDNAME + 1] = DEFAULT_CLUSTER_HOST;
static char command_string[512] = "";
int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
-char system_runtime_dir[PATH_NAME_MAX + 1]; // Layout->runtimedir
char system_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir
static char error_tags[1024] = "";
@@ -247,24 +246,19 @@ init_system()
static void
check_lockfile()
{
- char *lockfile = NULL;
+ xptr<char> rundir(RecConfigReadRuntimeDir());
+ xptr<char> lockfile;
pid_t holding_pid;
int err;
- if (access(Layout::get()->runtimedir, R_OK | W_OK) == -1) {
- fprintf(stderr,"unable to access() dir'%s': %d, %s\n",
- Layout::get()->runtimedir, errno, strerror(errno));
- fprintf(stderr," please set correct path in env variable TS_ROOT \n");
- _exit(1);
- }
- lockfile = Layout::relative_to(Layout::get()->runtimedir, SERVER_LOCK);
+ lockfile = Layout::relative_to(rundir, SERVER_LOCK);
Lockfile server_lockfile(lockfile);
err = server_lockfile.Get(&holding_pid);
if (err != 1) {
char *reason = strerror(-err);
- fprintf(stderr, "WARNING: Can't acquire lockfile '%s'", lockfile);
+ fprintf(stderr, "WARNING: Can't acquire lockfile '%s'", (const char *)lockfile);
if ((err == 0) && (holding_pid != -1)) {
fprintf(stderr, " (Lock file held by process ID %ld)\n", (long)holding_pid);
@@ -277,16 +271,16 @@ check_lockfile()
}
_exit(1);
}
- ats_free(lockfile);
}
static void
init_dirs(void)
{
+ xptr<char> rundir(RecConfigReadRuntimeDir());
+
char buf[PATH_NAME_MAX + 1];
ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, PATH_NAME_MAX);
- ink_strlcpy(system_runtime_dir, Layout::get()->runtimedir, PATH_NAME_MAX);
/*
* XXX: There is not much sense in the following code
@@ -305,15 +299,11 @@ init_dirs(void)
}
}
- if (access(system_runtime_dir, R_OK | W_OK) == -1) {
- REC_ReadConfigString(buf, "proxy.config.local_state_dir", PATH_NAME_MAX);
- Layout::get()->relative(system_runtime_dir, PATH_NAME_MAX, buf);
- if (access(system_runtime_dir, R_OK | W_OK) == -1) {
- fprintf(stderr,"unable to access() local state dir '%s': %d, %s\n",
- system_runtime_dir, errno, strerror(errno));
- fprintf(stderr,"please set 'proxy.config.local_state_dir'\n");
- _exit(1);
- }
+ if (access(rundir, R_OK | W_OK) == -1) {
+ fprintf(stderr,"unable to access() local state dir '%s': %d, %s\n",
+ (const char *)rundir, errno, strerror(errno));
+ fprintf(stderr,"please set 'proxy.config.local_state_dir'\n");
+ _exit(1);
}
}
@@ -553,12 +543,13 @@ cmd_clear(char *cmd)
//bool c_adb = !strcmp(cmd, "clear_authdb");
bool c_cache = !strcmp(cmd, "clear_cache");
- char p[PATH_NAME_MAX];
if (c_all || c_hdb) {
- Note("Clearing Configuration");
- Layout::relative_to(p, sizeof(p), system_runtime_dir, "hostdb.config");
- if (unlink(p) < 0)
- Note("unable to unlink %s", p);
+ xptr<char> rundir(RecConfigReadRuntimeDir());
+ xptr<char> config(Layout::relative_to(rundir, "hostdb.config"));
+
+ Note("Clearing HostDB Configuration");
+ if (unlink(config) < 0)
+ Note("unable to unlink %s", (const char *)config);
}
if (c_all || c_cache) {
@@ -569,6 +560,7 @@ cmd_clear(char *cmd)
return CMD_FAILED;
}
}
+
if (c_hdb || c_all) {
Note("Clearing Host Database");
if (hostDBProcessor.cache()->start(PROCESSOR_RECONFIGURE) < 0) {
@@ -1288,8 +1280,6 @@ main(int /* argc ATS_UNUSED */, char **argv)
fprintf(stderr, "%s\n", appVersionInfo.FullVersionInfoStr);
_exit(0);
}
- // Ensure only one copy of traffic server is running
- check_lockfile();
// Set stdout/stdin to be unbuffered
setbuf(stdout, NULL);
@@ -1321,6 +1311,9 @@ main(int /* argc ATS_UNUSED */, char **argv)
// Local process manager
initialize_process_manager();
+ // Ensure only one copy of traffic server is running
+ check_lockfile();
+
// Set the core limit for the process
init_core_size();
init_system();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/proxy/StatSystem.cc
----------------------------------------------------------------------
diff --git a/proxy/StatSystem.cc b/proxy/StatSystem.cc
index bdde869..87647eb 100644
--- a/proxy/StatSystem.cc
+++ b/proxy/StatSystem.cc
@@ -474,24 +474,14 @@ initialize_all_global_stats()
{
int istat, i;
char snap_file[PATH_NAME_MAX + 1];
- char local_state_dir[PATH_NAME_MAX + 1];
+ xptr<char> rundir(RecConfigReadRuntimeDir());
- // Jira TS-21
- REC_ReadConfigString(local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
- if (local_state_dir[0] != '/') {
- // Not an absolute path
- Layout::get()->relative(local_state_dir, sizeof(local_state_dir), local_state_dir);
- }
- if (access(local_state_dir, R_OK | W_OK) == -1) {
- ink_strlcpy(local_state_dir, system_runtime_dir, sizeof(local_state_dir));
- if (access(local_state_dir, R_OK | W_OK) == -1) {
- Warning("Unable to access() local state directory '%s': %d, %s", local_state_dir, errno, strerror(errno));
- Warning(" Please set 'proxy.config.local_state_dir' to allow statistics collection");
- }
+ if (access(rundir, R_OK | W_OK) == -1) {
+ Warning("Unable to access() local state directory '%s': %d, %s", (const char *)rundir, errno, strerror(errno));
+ Warning(" Please set 'proxy.config.local_state_dir' to allow statistics collection");
}
REC_ReadConfigString(snap_file, "proxy.config.stats.snap_file", PATH_NAME_MAX);
- Layout::relative_to(snap_filename, sizeof(snap_filename),
- local_state_dir, snap_file);
+ Layout::relative_to(snap_filename, sizeof(snap_filename), (const char *)rundir, snap_file);
Debug("stats", "stat snap filename %s", snap_filename);
statPagesManager.register_http("stat", stat_callback);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index 5bf3b6f..e731851 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -57,7 +57,6 @@ int auto_clear_hostdb_flag = 0;
char proxy_name[MAXDNAME + 1] = "unknown";
char system_config_directory[PATH_NAME_MAX + 1] = "";
-char system_runtime_dir[PATH_NAME_MAX + 1] = "";
char error_tags[1024] = "";
char action_tags[1024] = "";
Re: [07/11] git commit: TS-2401: Remove global system_runtime_dir
Posted by Igor Galić <i....@brainsware.org>.
> // XXX: Shouldn't that be 0664?
> //
I think you closed TS-666 prematurely. In its stead, I opened
https://issues.apache.org/jira/browse/TS-2421 for this particular issue.
i
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 8716 7A9F 989B ABD5 100F 4008 F266 55D6 2998 1641
Re: [07/11] git commit: TS-2401: Remove global system_runtime_dir
Posted by James Peach <jp...@apache.org>.
On Dec 6, 2013, at 8:15 AM, Igor Galić <i....@brainsware.org> wrote:
>
>
> ----- Original Message -----
>> TS-2401: Remove global system_runtime_dir
>>
>> Introduce RecConfigReadRuntimeDir() to centralize overriding
>> Layout::runtimedir with proxy.config.local_state_dir. Use this to
>> replace all the instances of system_runtime_dir.
>
> Do I understand it correctly that we can now (or always could?)
> easily relocate a trafficserver installation, and run multiple instances
> by simply setting a different proxy.config.local_state_dir ?
This feature was always present, but inconsistently applied. It should work correctly now. You have always been able to use $TS_ROOT to relocate $PREFIX and I've used that for test suites. Soon I'll post a patch that uses it ;)
>
> Analogous to https://httpd.apache.org/docs/current/mod/core.html#defaultruntimedir )
>
> I'm aware that this isn't useful for most users, but it may well be
> useful to developers.
Probably useful to ops in certain deployment environments.
J
Re: [07/11] git commit: TS-2401: Remove global system_runtime_dir
Posted by Igor Galić <i....@brainsware.org>.
----- Original Message -----
> TS-2401: Remove global system_runtime_dir
>
> Introduce RecConfigReadRuntimeDir() to centralize overriding
> Layout::runtimedir with proxy.config.local_state_dir. Use this to
> replace all the instances of system_runtime_dir.
Do I understand it correctly that we can now (or always could?)
easily relocate a trafficserver installation, and run multiple instances
by simply setting a different proxy.config.local_state_dir ?
Analogous to https://httpd.apache.org/docs/current/mod/core.html#defaultruntimedir )
I'm aware that this isn't useful for most users, but it may well be
useful to developers.
++ i
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 8716 7A9F 989B ABD5 100F 4008 F266 55D6 2998 1641