TS-2401: Remove system_config_directory Remove all the places the global system_config_directory is used, replacing it with Layout::get()->sysconfdir where appropriate.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/67306a71 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/67306a71 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/67306a71 Branch: refs/heads/5.0.x Commit: 67306a71da65f135ff85c2f4d9b966122fa5590a Parents: f438ab4 Author: James Peach <jpe...@apache.org> Authored: Mon Dec 2 14:48:49 2013 -0800 Committer: James Peach <jpe...@apache.org> Committed: Thu Dec 5 20:33:49 2013 -0800 ---------------------------------------------------------------------- example/app-template/app-template.cc | 7 --- lib/records/I_RecCore.h | 11 +++- lib/records/I_RecDefs.h | 3 - lib/records/RecCore.cc | 34 ++++++++++++ mgmt/FileManager.cc | 92 +++++-------------------------- mgmt/FileManager.h | 1 - mgmt/LocalManager.cc | 18 ++---- mgmt/LocalManager.h | 4 +- mgmt/Main.cc | 18 ++---- mgmt/Main.h | 1 - mgmt/Rollback.cc | 34 +++--------- mgmt/Rollback.h | 1 - mgmt/cluster/VMap.cc | 13 ++--- mgmt/web2/WebIntrMain.cc | 4 +- proxy/ControlMatcher.cc | 13 ++--- proxy/ControlMatcher.h | 5 +- proxy/ICPConfig.cc | 13 ++--- proxy/IPAllow.cc | 13 ++--- proxy/IPAllow.h | 1 - proxy/InkAPI.cc | 3 +- proxy/Main.cc | 35 +++--------- proxy/Plugin.cc | 32 +---------- proxy/Plugin.h | 3 +- proxy/Prefetch.cc | 15 ++--- proxy/Update.cc | 10 ++-- proxy/http/HttpBodyFactory.cc | 27 ++++----- proxy/http/HttpBodyFactory.h | 1 - proxy/logging/LogConfig.cc | 30 ++++------ proxy/logging/LogStandalone.cc | 4 -- proxy/sac.cc | 8 +-- 30 files changed, 151 insertions(+), 303 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/example/app-template/app-template.cc ---------------------------------------------------------------------- diff --git a/example/app-template/app-template.cc b/example/app-template/app-template.cc index af23b2b..234bf77 100644 --- a/example/app-template/app-template.cc +++ b/example/app-template/app-template.cc @@ -53,8 +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_config_directory[PATH_NAME_MAX + 1]; - //int system_remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG; //Diags *diags = NULL; @@ -154,9 +152,6 @@ int main(int argc, char * argv[]) _exit(0); } - // Get TS directories - ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, sizeof(system_config_directory)); - if (chdir(Layout::get()->prefix) < 0) { fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", Layout::get()->prefix, errno, strerror(errno)); fprintf(stderr," please set correct path in env variable TS_ROOT \n"); @@ -226,8 +221,6 @@ int main(int argc, char * argv[]) // initialize logging (after event and net processor) //Log::init(system_remote_management_flag ? 0 : Log::NO_REMOTE_MANAGEMENT); - //plugin_init(system_config_directory); // plugin.config - // Create accept continuation MyAccept *a = new MyAccept; a->accept_port = tsapp_port; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/lib/records/I_RecCore.h ---------------------------------------------------------------------- diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h index 86f6595..44b0922 100644 --- a/lib/records/I_RecCore.h +++ b/lib/records/I_RecCore.h @@ -46,9 +46,18 @@ 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(). +// caller MUST release the result with ats_free(). char * RecConfigReadRuntimeDir(); +// Return a copy of the system's snapshot directory, taking proxy.config.snapshot_dir into account. The caller +// MUST release the result with ats_free(). +char * RecConfigReadSnapshotDir(); + +// Return a copy of a configuration file that is relative to sysconfdir. The relative path to the configuration +// file is specified in the configuration variable named by "file_variable". If the configuration variable has no +// value, NULL is returned. The caller MUST release the result with ats_free(). +char * RecConfigReadConfigPath(const char * file_variable); + // 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/67306a71/lib/records/I_RecDefs.h ---------------------------------------------------------------------- diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h index 928a5ac..5a9c121 100644 --- a/lib/records/I_RecDefs.h +++ b/lib/records/I_RecDefs.h @@ -175,7 +175,4 @@ 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_config_directory[PATH_NAME_MAX + 1]; - #endif http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/lib/records/RecCore.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc index 50485fa..d76cb90 100644 --- a/lib/records/RecCore.cc +++ b/lib/records/RecCore.cc @@ -1071,6 +1071,40 @@ RecConfigReadRuntimeDir() } //------------------------------------------------------------------------- +// RecConfigReadSnapshotDir. +//------------------------------------------------------------------------- +char * +RecConfigReadSnapshotDir() +{ + char buf[PATH_NAME_MAX + 1]; + + buf[0] = '\0'; + RecGetRecordString("proxy.config.snapshot_dir", buf, PATH_NAME_MAX); + if (strlen(buf) > 0) { + return Layout::get()->relative_to(Layout::get()->sysconfdir, buf); + } else { + return Layout::get()->relative_to(Layout::get()->sysconfdir, "snapshots"); + } +} + +//------------------------------------------------------------------------- +// RecConfigReadConfigPath +//------------------------------------------------------------------------- +char * +RecConfigReadConfigPath(const char * file_variable) +{ + char buf[PATH_NAME_MAX + 1]; + + buf[0] = '\0'; + RecGetRecordString(file_variable, buf, PATH_NAME_MAX); + if (strlen(buf) > 0) { + return Layout::get()->relative_to(Layout::get()->sysconfdir, buf); + } + + return NULL; +} + +//------------------------------------------------------------------------- // REC_SignalManager (TS) //------------------------------------------------------------------------- #if defined (REC_BUILD_MGMT) http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/FileManager.cc ---------------------------------------------------------------------- diff --git a/mgmt/FileManager.cc b/mgmt/FileManager.cc index 33cafe7..8480ede 100644 --- a/mgmt/FileManager.cc +++ b/mgmt/FileManager.cc @@ -32,10 +32,6 @@ #include "ExpandingArray.h" #include "MgmtSocket.h" - - -static const char snapDir[] = "snapshots"; - #define DIR_MODE S_IRWXU #define FILE_MODE S_IRWXU @@ -56,51 +52,24 @@ const char *SnapshotStrings[] = { "Request Successful\n", FileManager::FileManager() { - char configTmp[PATH_NAME_MAX + 1]; - int pathLen; - bindings = ink_hash_table_create(InkHashTableKeyType_String); - ink_assert(bindings != NULL); ink_mutex_init(&accessLock, "File Manager Mutex"); ink_mutex_init(&cbListLock, "File Changed Callback Mutex"); - if (varStrFromName("proxy.config.config_dir", configTmp, sizeof(configTmp)) == false) { - mgmt_fatal(stderr, 0, - "[FileManager::FileManager] Unable to find configuration directory from proxy.config.config_dir\n"); - } - if (configTmp[0] != '/') { - // Make it TS_ROOT relative - Layout::get()->relative(configTmp, sizeof(configTmp), configTmp); - } - if (access(configTmp, R_OK) == -1) { - ink_strlcpy(configTmp, system_config_directory,sizeof(configTmp)); - if (access(configTmp, R_OK) == -1) { - mgmt_elog(0, "[FileManager::FileManager] unable to access() directory '%s': %d, %s\n", - mgmt_path, errno, strerror(errno)); - mgmt_elog(0, "[FileManager::FileManager] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n"); - _exit(1); - } - } - // Set up the path to the snap shot dir - pathLen = strlen(configTmp) + strlen(snapDir) + 3; - const size_t snapshotDir_size = pathLen + 1; - snapshotDir = new char[snapshotDir_size]; - ink_filepath_make(snapshotDir, snapshotDir_size, configTmp, snapDir); - - // Set up info for MultiFile - managedDir = snapshotDir; - dirDescript = "snapshot"; - - // Check to see if the directory already exists, if not create - // it + xptr<char> snapshotDir(RecConfigReadSnapshotDir()); + + // Check to see if the directory already exists, if not create it. if (access(snapshotDir, F_OK) == -1) { if (mkdir(snapshotDir, DIR_MODE) < 0) { // Failed to create the snapshot directory - mgmt_fatal(stderr, 0, "[FileManager::FileManager] Failed to create the snapshot directory %s: %s\n", snapshotDir, strerror(errno)); + mgmt_fatal(stderr, 0, "[FileManager::FileManager] Failed to create the snapshot directory %s: %s\n", (const char *)snapshotDir, strerror(errno)); } } + + this->managedDir = snapshotDir.release(); + this->dirDescript = "snapshot"; } // FileManager::~FileManager @@ -117,11 +86,12 @@ FileManager::~FileManager() InkHashTableEntry *entry; InkHashTableIteratorState iterator_state; - // Let other operations finish and do not start any - // new ones + // Let other operations finish and do not start any new ones ink_mutex_acquire(&accessLock); - delete[]snapshotDir; + ats_free(this->managedDir); + this->managedDir = NULL; + this->dirDescript = NULL; for (cb = cblist.pop(); cb != NULL; cb = cblist.pop()) { delete cb; @@ -688,45 +658,13 @@ FileManager::copyFile(Rollback * rb, const char *snapPath) SnapResult FileManager::WalkSnaps(ExpandingArray * snapList) { - MFresult r; - // These aren't used. - //char altSnapshotDir[256]; - //InkHashTableValue snapDirLookup; - //fileBinding* snapBind; - //InkHashTableEntry *entry; - //InkHashTableIteratorState iterator_state; - //char *filePath; - bool found; - char config_dir[256]; - char *snapshot_dir; - ink_mutex_acquire(&accessLock); - snapshot_dir = (char *) REC_readString("proxy.config.snapshot_dir", &found); - ink_assert(found); - //config_dir = lmgmt->record_data->readString("proxy.config.config_dir", &found); - //ink_assert(found); - - if (varStrFromName("proxy.config.config_dir", config_dir, 256) == false) { - mgmt_fatal(stderr, 0, - "[FileManager::FileManager] Unable to find configuration directory from proxy.config.config_dir\n"); - } - - if (snapshot_dir == NULL) { - const size_t snapshot_dir_size = strlen("snapshots"); - snapshot_dir = new char[snapshot_dir_size]; - ink_assert(snapshot_dir); - snprintf(snapshot_dir, snapshot_dir_size, "%s", "snapshots"); - RecSetRecordString("proxy.config.snapshot_dir", snapshot_dir); - } - //if(strncmp(snapshot_dir, config_dir, strlen(config_dir))) - if (snapshot_dir[0] != '/') - managedDir = newPathString(config_dir, snapshot_dir); - else - managedDir = snapshot_dir; - //else - //managedDir = snapshot_dir; + // The original code reset this->managedDir from proxy.config.snapshot_dir at this point. There doesn't appear to be + // any need for that, since managedDir is always set in the constructor and should not be changed. + ink_release_assert(this->managedDir != NULL); + ink_mutex_acquire(&accessLock); r = WalkFiles(snapList); //lmgmt->record_data ->setString("proxy.config.snapshot_dir", managedDir); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/FileManager.h ---------------------------------------------------------------------- diff --git a/mgmt/FileManager.h b/mgmt/FileManager.h index 0d618b0..1824d5a 100644 --- a/mgmt/FileManager.h +++ b/mgmt/FileManager.h @@ -134,7 +134,6 @@ private: DLL<callbackListable> cblist; InkHashTable *bindings; //InkHashTable* g_snapshot_directory_ht; - char *snapshotDir; SnapResult copyFile(Rollback * rb, const char *snapPath); SnapResult readFile(const char *filePath, textBuffer * contents); void abortRestore(const char *abortTo); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/LocalManager.cc ---------------------------------------------------------------------- diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index 4572b57..21d05e6 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -200,7 +200,7 @@ LocalManager::processRunning() } } -LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on) +LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on) { bool found; @@ -238,18 +238,10 @@ LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on) // Get the default IP binding values. RecHttpLoadIp("proxy.local.incoming_ip_to_bind", m_inbound_ip4, m_inbound_ip6); - config_path = REC_readString("proxy.config.config_dir", &found); - char *absolute_config_path = Layout::get()->relative(config_path); - ats_free(config_path); - if (access(absolute_config_path, R_OK) == -1) { - config_path = ats_strdup(system_config_directory); - if (access(config_path, R_OK) == -1) { - mgmt_elog(0, "[LocalManager::LocalManager] unable to access() directory '%s': %d, %s\n", - config_path, errno, strerror(errno)); - mgmt_fatal(0, "[LocalManager::LocalManager] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n"); - } - } else { - config_path = absolute_config_path; + if (access(Layout::get()->sysconfdir, R_OK) == -1) { + mgmt_elog(0, "[LocalManager::LocalManager] unable to access() directory '%s': %d, %s\n", + Layout::get()->sysconfdir, errno, strerror(errno)); + mgmt_fatal(0, "[LocalManager::LocalManager] please set the 'TS_ROOT' environment variable\n"); } #if TS_HAS_WCCP http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/LocalManager.h ---------------------------------------------------------------------- diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h index 8c60978..8370a02 100644 --- a/mgmt/LocalManager.h +++ b/mgmt/LocalManager.h @@ -50,14 +50,13 @@ class LocalManager: public BaseManager { public: - LocalManager(char *mpath, bool proxy_on); + LocalManager(bool proxy_on); ~LocalManager() { delete alarm_keeper; delete virt_map; delete ccom; - ats_free(config_path); ats_free(bin_path); ats_free(absolute_proxy_binary); ats_free(proxy_name); @@ -125,7 +124,6 @@ public: int process_server_timeout_msecs; char pserver_path[PATH_NAME_MAX]; - char *config_path; char *bin_path; char *absolute_proxy_binary; char *proxy_name; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Main.cc ---------------------------------------------------------------------- diff --git a/mgmt/Main.cc b/mgmt/Main.cc index c33f564..0219e68 100644 --- a/mgmt/Main.cc +++ b/mgmt/Main.cc @@ -64,6 +64,8 @@ extern "C" int getpwnam_r(const char *name, struct passwd *result, char *buffer, size_t buflen, struct passwd **resptr); #endif +static void extractConfigInfo(char *mgmt_path, const char *recs_conf, char *userName, int *fds_throttle); + LocalManager *lmgmt = NULL; FileManager *configFiles; @@ -77,9 +79,6 @@ static char debug_tags[1024] = ""; static char action_tags[1024] = ""; static bool proxy_on = true; -// TODO: Check if really need those -char system_config_directory[PATH_NAME_MAX + 1]; - char mgmt_path[PATH_NAME_MAX + 1]; // By default, set the current directory as base @@ -267,18 +266,13 @@ static void init_dirs() { xptr<char> rundir(RecConfigReadRuntimeDir()); - char buf[PATH_NAME_MAX + 1]; - REC_ReadConfigString(buf, "proxy.config.config_dir", PATH_NAME_MAX); - Layout::get()->relative(system_config_directory, PATH_NAME_MAX, buf); - if (access(system_config_directory, R_OK) == -1) { - mgmt_elog(0, "unable to access() config dir '%s': %d, %s\n", system_config_directory, errno, strerror(errno)); - mgmt_elog(0, "please set config path via 'proxy.config.config_dir' \n"); + if (access(Layout::get()->sysconfdir, R_OK) == -1) { + mgmt_elog(0, "unable to access() config dir '%s': %d, %s\n", Layout::get()->sysconfdir, errno, strerror(errno)); + mgmt_elog(0, "please set the 'TS_ROOT' environment variable\n"); _exit(1); } - ink_strlcpy(mgmt_path, system_config_directory, sizeof(mgmt_path)); - 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"); @@ -562,7 +556,7 @@ main(int argc, char **argv) Init_Errata_Logging(); #endif ts_host_res_global_init(); - lmgmt = new LocalManager(mgmt_path, proxy_on); + lmgmt = new LocalManager(proxy_on); RecLocalInitMessage(); lmgmt->initAlarm(); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Main.h ---------------------------------------------------------------------- diff --git a/mgmt/Main.h b/mgmt/Main.h index 12b9059..b401257 100644 --- a/mgmt/Main.h +++ b/mgmt/Main.h @@ -37,7 +37,6 @@ void MgmtShutdown(int status); void fileUpdated(char *fname, bool incVersion); void runAsUser(char *userName); -void extractConfigInfo(char *mgmt_path, const char *recs_conf, char *userName, int *fds_throttle); void printUsage(void); extern FileManager *configFiles; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Rollback.cc ---------------------------------------------------------------------- diff --git a/mgmt/Rollback.cc b/mgmt/Rollback.cc index 0a4c961..6c219e3 100644 --- a/mgmt/Rollback.cc +++ b/mgmt/Rollback.cc @@ -30,6 +30,7 @@ #include "ExpandingArray.h" #include "MgmtSocket.h" #include "ink_cap.h" +#include "I_Layout.h" #define MAX_VERSION_DIGITS 11 #define DEFAULT_BACKUPS 2 @@ -45,14 +46,11 @@ const char *RollbackStrings[] = { "Rollback Ok", Rollback::Rollback(const char *baseFileName, bool root_access_needed_) : root_access_needed(root_access_needed_) { - char configTmp[PATH_NAME_MAX + 1]; version_t highestSeen; // the highest backup version ExpandingArray existVer(25, true); // Exsisting versions struct stat fileInfo; MgmtInt numBak; char *alarmMsg; - struct stat s; - int err; // To Test, Read/Write access to the file int testFD; // For open test @@ -70,20 +68,13 @@ Rollback::Rollback(const char *baseFileName, bool root_access_needed_) fileName = new char[fileNameLen + 1]; ink_strlcpy(fileName, baseFileName, fileNameLen + 1); - - // Get the configuration directory - SHOULD BE CENTRALIZED SOMEWHERE // TODO: Use the runtime directory for storing mutable data // XXX: Sysconfdir should be imutable!!! - // - if (varStrFromName("proxy.config.config_dir", configTmp, PATH_NAME_MAX) == false) { - mgmt_log(stderr, "[Rollback::Rollback] Unable to find configuration directory from proxy.config.config_dir\n"); - ink_assert(0); - } - if ((err = stat(system_config_directory, &s)) < 0) { - mgmt_elog(0, "[Rollback::Rollback] unable to stat() directory '%s': %d %d, %s\n", - system_config_directory, err, errno, strerror(errno)); - mgmt_elog(0, "[Rollback::Rollback] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n"); + if (access(Layout::get()->sysconfdir, F_OK) < 0) { + mgmt_elog(0, "[Rollback::Rollback] unable to access() directory '%s': %d, %s\n", + Layout::get()->sysconfdir, errno, strerror(errno)); + mgmt_elog(0, "[Rollback::Rollback] please set the 'TS_ROOT' environment variable\n"); _exit(1); } @@ -96,12 +87,6 @@ Rollback::Rollback(const char *baseFileName, bool root_access_needed_) } else { numberBackups = DEFAULT_BACKUPS; } - // TODO: Use strdup/free instead C++ new - // - int configDirLen = strlen(system_config_directory) + 1; - configDir = new char[configDirLen]; - ink_strlcpy(configDir, system_config_directory, configDirLen); - ink_mutex_init(&fileAccessLock, "RollBack Mutex"); @@ -227,7 +212,6 @@ Rollback::Rollback(const char *baseFileName, bool root_access_needed_) Rollback::~Rollback() { delete[]fileName; - delete[]configDir; } @@ -240,11 +224,11 @@ Rollback::createPathStr(version_t version) { char *buffer; - int bufSize = strlen(configDir) + fileNameLen + MAX_VERSION_DIGITS + 1; + int bufSize = strlen(Layout::get()->sysconfdir) + fileNameLen + MAX_VERSION_DIGITS + 1; buffer = new char[bufSize]; - ink_filepath_make(buffer, bufSize, configDir, fileName); + Layout::get()->relative_to(buffer, bufSize, Layout::get()->sysconfdir, fileName); if (version != ACTIVE_VERSION) { size_t pos = strlen(buffer); @@ -727,11 +711,11 @@ Rollback::findVersions_ml(ExpandingArray * listNames) struct dirent *dirEntrySpace; struct dirent *entryPtr; - dir = opendir(configDir); + dir = opendir(Layout::get()->sysconfdir); if (dir == NULL) { mgmt_log(stderr, "[Rollback::findVersions] Unable to open configuration directory: %s: %s\n", - configDir, strerror(errno)); + Layout::get()->sysconfdir, strerror(errno)); return INVALID_VERSION; } // The fun of Solaris - readdir_r requires a buffer passed into it http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Rollback.h ---------------------------------------------------------------------- diff --git a/mgmt/Rollback.h b/mgmt/Rollback.h index c033161..e3025a6 100644 --- a/mgmt/Rollback.h +++ b/mgmt/Rollback.h @@ -207,7 +207,6 @@ private: int statFile(version_t version, struct stat *buf); char *createPathStr(version_t version); RollBackCodes internalUpdate(textBuffer * buf, version_t newVersion, bool notifyChange = true, bool incVersion = true); - char *configDir; ink_mutex fileAccessLock; char *fileName; size_t fileNameLen; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/cluster/VMap.cc ---------------------------------------------------------------------- diff --git a/mgmt/cluster/VMap.cc b/mgmt/cluster/VMap.cc index 5539e6f..43cba20 100644 --- a/mgmt/cluster/VMap.cc +++ b/mgmt/cluster/VMap.cc @@ -35,6 +35,7 @@ #include "VMap.h" #include "MgmtUtils.h" #include "P_RecLocal.h" +#include "I_Layout.h" // for linux and freebsd #ifndef C_ISUID @@ -303,19 +304,17 @@ VMap::lt_runGambit() * vaddr file. */ void -VMap::lt_readAListFile(char *data) +VMap::lt_readAListFile(char * data) { int tmp_num_addrs = 0; - char buf[1024], fname[1024]; + char buf[1024]; char tmp_addr[1024], tmp_interface[1024]; FILE *fin; char tmp_id[1024]; + xptr<char> vaddr_path(Layout::get()->relative_to(Layout::get()->sysconfdir, data)); - if (!data) - return; - snprintf(fname, sizeof(fname), "%s/%s", lmgmt->config_path, data); - if (!(fin = fopen(fname, "r"))) { - mgmt_log(stderr, "[VMap::lt_readAListFile] Unable to open file: %s, addr list unchanged\n", fname); + if (!(fin = fopen(vaddr_path, "r"))) { + mgmt_log(stderr, "[VMap::lt_readAListFile] Unable to open file: %s, addr list unchanged\n", (const char *)vaddr_path); return; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/web2/WebIntrMain.cc ---------------------------------------------------------------------- diff --git a/mgmt/web2/WebIntrMain.cc b/mgmt/web2/WebIntrMain.cc index c3a6732..57a2066 100644 --- a/mgmt/web2/WebIntrMain.cc +++ b/mgmt/web2/WebIntrMain.cc @@ -415,11 +415,11 @@ webIntr_main(void *) if ((err = stat(autoconfContext.docRoot, &s)) < 0) { ats_free(autoconfContext.docRoot); - autoconfContext.docRoot = ats_strdup(system_config_directory); + autoconfContext.docRoot = ats_strdup(Layout::get()->sysconfdir); if ((err = stat(autoconfContext.docRoot, &s)) < 0) { mgmt_elog(0, "[WebIntrMain] unable to stat() directory '%s': %d %d, %s\n", autoconfContext.docRoot, err, errno, strerror(errno)); - mgmt_elog(0, "[WebIntrMain] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n"); + mgmt_elog(0, "[WebIntrMain] please set the 'TS_ROOT' environment variable\n"); mgmt_fatal(stderr, 0, "[WebIntrMain] No Client AutoConf Root\n"); } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/ControlMatcher.cc ---------------------------------------------------------------------- diff --git a/proxy/ControlMatcher.cc b/proxy/ControlMatcher.cc index 6680d69..7828e7e 100644 --- a/proxy/ControlMatcher.cc +++ b/proxy/ControlMatcher.cc @@ -694,8 +694,6 @@ template<class Data, class Result> ControlMatcher<Data, Result>::ControlMatcher(const char *file_var, const char *name, const matcher_tags * tags, int flags_in) { - char *config_file = NULL; - flags = flags_in; ink_assert(flags & (ALLOW_HOST_TABLE | ALLOW_REGEX_TABLE | ALLOW_URL_TABLE | ALLOW_IP_TABLE)); @@ -703,16 +701,14 @@ ControlMatcher<Data, Result>::ControlMatcher(const char *file_var, const char *n ink_assert(config_tags != NULL); matcher_name = name; - config_file_var = ats_strdup(file_var); config_file_path[0] = '\0'; - REC_ReadConfigStringAlloc(config_file, config_file_var); - if (!(flags & DONT_BUILD_TABLE)) { - ink_release_assert(config_file != NULL); - ink_filepath_make(config_file_path, sizeof(config_file_path), system_config_directory, config_file); + xptr<char> config_path(RecConfigReadConfigPath(file_var)); + + ink_release_assert(config_path); + ink_strlcpy(config_file_path, config_path, sizeof(config_file_path)); } - ats_free(config_file); reMatch = NULL; urlMatch = NULL; @@ -729,7 +725,6 @@ ControlMatcher<Data, Result>::ControlMatcher(const char *file_var, const char *n template<class Data, class Result> ControlMatcher<Data, Result>::~ControlMatcher() { - ats_free(config_file_var); delete reMatch; delete urlMatch; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/ControlMatcher.h ---------------------------------------------------------------------- diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h index c6f1c1b..c78db65 100644 --- a/proxy/ControlMatcher.h +++ b/proxy/ControlMatcher.h @@ -32,8 +32,8 @@ * * The control matcher module provides the ability to lookup arbitrary * information specific to a URL and IP address. The outside - * world only sees the ControlMatcher class which parses the revelvant - * configuration file and builds the lookups table + * world only sees the ControlMatcher class which parses the relevant + * configuration file and builds the lookup table * * Four types of matched are supported: hostname, domain name, ip address * and URL regex. For these four types, three lookup tables are used. Regex and @@ -277,7 +277,6 @@ public: int BuildTableFromString(char *str); void Match(RequestData * rdata, Result * result); void Print(); - char *config_file_var; // temporary: until config is integerated int getEntryCount() { return m_numEntries; } HostMatcher<Data, Result> *getHostMatcher() { return hostMatch; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/ICPConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc index 3e19557..b5192d2 100644 --- a/proxy/ICPConfig.cc +++ b/proxy/ICPConfig.cc @@ -38,6 +38,7 @@ #include "ICPProcessor.h" #include "ICPlog.h" #include "BaseManager.h" +#include "I_Layout.h" //-------------------------------------------------------------------------- // Each ICP peer is described in "icp.config" with the @@ -542,14 +543,10 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu // // Build pathname to "icp.config" and open file // - ink_assert(filename); - char ConfigFilePath[PATH_NAME_MAX]; - if (filename) { - ink_strlcpy(ConfigFilePath, system_config_directory, sizeof(ConfigFilePath)); - ink_strlcat(ConfigFilePath, "/", sizeof(ConfigFilePath)); - ink_strlcat(ConfigFilePath, filename, sizeof(ConfigFilePath)); - } - int fd = open(ConfigFilePath, O_RDONLY); + ink_release_assert(filename != NULL); + + xptr<char> config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename)); + int fd = open(config_path, O_RDONLY); if (fd < 0) { Warning("read icp.config, open failed"); REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, open failed"); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/IPAllow.cc ---------------------------------------------------------------------- diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc index 2cd1d77..07c9eee 100644 --- a/proxy/IPAllow.cc +++ b/proxy/IPAllow.cc @@ -104,20 +104,15 @@ IpAllow::IpAllow( const char *config_var, const char *name, const char *action_val -) : config_file_var(config_var), - module_name(name), +) : module_name(name), action(action_val) { + xptr<char> config_path(RecConfigReadConfigPath(config_var)); - char *config_file; - - config_file_var = ats_strdup(config_var); config_file_path[0] = '\0'; + ink_release_assert(config_path); - REC_ReadConfigStringAlloc(config_file, (char *) config_file_var); - ink_release_assert(config_file != NULL); - ink_filepath_make(config_file_path, sizeof(config_file_path), system_config_directory, config_file); - ats_free(config_file); + ink_strlcpy(config_file_path, config_path, sizeof(config_file_path)); } IpAllow::~IpAllow() http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/IPAllow.h ---------------------------------------------------------------------- diff --git a/proxy/IPAllow.h b/proxy/IPAllow.h index 76ecdf4..2c2d232 100644 --- a/proxy/IPAllow.h +++ b/proxy/IPAllow.h @@ -98,7 +98,6 @@ private: int BuildTable(); - const char *config_file_var; char config_file_path[PATH_NAME_MAX]; const char *module_name; const char *action; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/InkAPI.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index 1b4ce13..1e8ecdf 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -1711,7 +1711,7 @@ TSInstallDirGet(void) const char * TSConfigDirGet(void) { - return system_config_directory; + return Layout::get()->sysconfdir; } const char * @@ -1719,6 +1719,7 @@ TSTrafficServerVersionGet(void) { return traffic_server_version; } + int TSTrafficServerVersionGetMajor() { return ts_major_version; } int TSTrafficServerVersionGetMinor() { return ts_minor_version; } int TSTrafficServerVersionGetPatch() { return ts_patch_version; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Main.cc ---------------------------------------------------------------------- diff --git a/proxy/Main.cc b/proxy/Main.cc index 2f3e19e..bc7c2d5 100644 --- a/proxy/Main.cc +++ b/proxy/Main.cc @@ -144,8 +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_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir - static char error_tags[1024] = ""; static char action_tags[1024] = ""; static int show_statistics = 0; @@ -274,29 +272,15 @@ check_lockfile() } static void -init_dirs(void) +check_config_directories(void) { xptr<char> rundir(RecConfigReadRuntimeDir()); - char buf[PATH_NAME_MAX + 1]; - - ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, PATH_NAME_MAX); - - /* - * XXX: There is not much sense in the following code - * The purpose of proxy.config.foo_dir should - * be checked BEFORE checking default foo directory. - * Otherwise one cannot change the config dir to something else - */ - if (access(system_config_directory, R_OK) == -1) { - REC_ReadConfigString(buf, "proxy.config.config_dir", PATH_NAME_MAX); - Layout::get()->relative(system_config_directory, PATH_NAME_MAX, buf); - if (access(system_config_directory, R_OK) == -1) { - fprintf(stderr,"unable to access() config dir '%s': %d, %s\n", - system_config_directory, errno, strerror(errno)); - fprintf(stderr, "please set config path via 'proxy.config.config_dir' \n"); - _exit(1); - } + if (access(Layout::get()->sysconfdir, R_OK) == -1) { + fprintf(stderr,"unable to access() config dir '%s': %d, %s\n", + Layout::get()->sysconfdir, errno, strerror(errno)); + fprintf(stderr, "please set the 'TS_ROOT' environment variable\n"); + _exit(1); } if (access(rundir, R_OK | W_OK) == -1) { @@ -327,15 +311,14 @@ initialize_process_manager() LibRecordsConfigInit(); RecordsConfigOverrideFromEnvironment(); } - // + // Start up manager - // pmgmt = NEW(new ProcessManager(remote_management_flag)); pmgmt->start(); RecProcessInitMessage(remote_management_flag ? RECM_CLIENT : RECM_STAND_ALONE); pmgmt->reconfigure(); - init_dirs();// setup directories + check_config_directories(); // // Define version info records @@ -1531,7 +1514,7 @@ main(int /* argc ATS_UNUSED */, char **argv) Log::init(remote_management_flag ? 0 : Log::NO_REMOTE_MANAGEMENT); // Init plugins as soon as logging is ready. - plugin_init(system_config_directory); // plugin.config + plugin_init(); // plugin.config pmgmt->registerPluginCallbacks(global_config_cbs); cacheProcessor.set_after_init_callback(&CB_After_Cache_Init); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Plugin.cc ---------------------------------------------------------------------- diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc index 5b2b19e..10ff423 100644 --- a/proxy/Plugin.cc +++ b/proxy/Plugin.cc @@ -221,36 +221,8 @@ not_found: return NULL; } - -int -plugins_exist(const char *config_dir) -{ - char path[PATH_NAME_MAX + 1]; - char line[1024], *p; - int fd; - int plugin_count = 0; - - ink_filepath_make(path, sizeof(path), config_dir, "plugin.config"); - fd = open(path, O_RDONLY); - if (fd < 0) { - Warning("unable to open plugin config file '%s': %d, %s", path, errno, strerror(errno)); - return 0; - } - while (ink_file_fd_readline(fd, sizeof(line) - 1, line) > 0) { - p = line; - // strip leading white space and test for comment or blank line - while (*p && ParseRules::is_wslfcr(*p)) - ++p; - if ((*p == '\0') || (*p == '#')) - continue; - plugin_count++; - } - close(fd); - return plugin_count; -} - void -plugin_init(const char *config_dir) +plugin_init(void) { char path[PATH_NAME_MAX + 1]; char line[1024], *p; @@ -267,7 +239,7 @@ plugin_init(const char *config_dir) INIT_ONCE = false; } - ink_filepath_make(path, sizeof(path), config_dir, "plugin.config"); + Layout::get()->relative_to(path, sizeof(path), Layout::get()->sysconfdir, "plugin.config"); fd = open(path, O_RDONLY); if (fd < 0) { Warning("unable to open plugin config file '%s': %d, %s", path, errno, strerror(errno)); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Plugin.h ---------------------------------------------------------------------- diff --git a/proxy/Plugin.h b/proxy/Plugin.h index 4173a05..4c1ad09 100644 --- a/proxy/Plugin.h +++ b/proxy/Plugin.h @@ -56,7 +56,6 @@ struct PluginRegInfo extern DLL<PluginRegInfo> plugin_reg_list; extern PluginRegInfo *plugin_reg_current; -void plugin_init(const char *config_dir); -int plugins_exist(const char *config_dir); +void plugin_init(void); #endif /* __PLUGIN_H__ */ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Prefetch.cc ---------------------------------------------------------------------- diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc index 69f2489..182e4c3 100644 --- a/proxy/Prefetch.cc +++ b/proxy/Prefetch.cc @@ -26,7 +26,6 @@ #include "Prefetch.h" #include "HdrUtils.h" #include "HttpCompat.h" -#include "I_Layout.h" #include <records/I_RecHttp.h> #include <ts/IpMapConf.h> @@ -1906,8 +1905,7 @@ config_read_proto(PrefetchBlastData &blast, const char *str) int PrefetchConfiguration::readConfiguration() { - char *conf_file_name; - char conf_path[PATH_NAME_MAX + 1]; + xptr<char> conf_path; int fd = -1; local_http_server_port = stuffer_port = 0; @@ -1944,24 +1942,21 @@ PrefetchConfiguration::readConfiguration() //pre_parse_hook = 0; //embedded_url_hook = 0; - conf_file_name = TS_ConfigReadString("proxy.config.prefetch.config_file"); - - if (conf_file_name == NULL) { + conf_path = RecConfigReadConfigPath("proxy.config.prefetch.config_file"); + if (!conf_path) { Warning("PrefetchProcessor: No prefetch configuration file specified. Prefetch disabled\n"); goto Lerror; } - Layout::relative_to(conf_path, sizeof(conf_path), system_config_directory, conf_file_name); - ats_free(conf_file_name); fd = open(conf_path, O_RDONLY); if (fd < 0) { - Error("PrefetchProcessor: Error, could not open '%s' disabling Prefetch\n", conf_path); + Error("PrefetchProcessor: Error, could not open '%s' disabling Prefetch\n", (const char *)conf_path); goto Lerror; } char *temp_str; if ((temp_str = Load_IpMap_From_File(&ip_map, fd, "prefetch_children")) != 0) { - Error("PrefetchProcessor: Error in reading ip_range from %s: %.256s\n", conf_path, temp_str); + Error("PrefetchProcessor: Error in reading ip_range from %s: %.256s\n", (const char *)conf_path, temp_str); ats_free(temp_str); goto Lerror; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Update.cc ---------------------------------------------------------------------- diff --git a/proxy/Update.cc b/proxy/Update.cc index 56e2367..cabfe62 100644 --- a/proxy/Update.cc +++ b/proxy/Update.cc @@ -32,7 +32,7 @@ #include "URL.h" #include "HdrUtils.h" #include <records/I_RecHttp.h> -//#include "MixtAPIInternal.h" +#include "I_Layout.h" RecRawStatBlock *update_rsb; @@ -875,17 +875,15 @@ UpdateConfigList * UpdateConfigManager::BuildUpdateList() { // Build pathname to "update.config" and open file + xptr<char> config_path; - char ConfigFilePath[PATH_NAME_MAX]; if (_filename) { - ink_strlcpy(ConfigFilePath, system_config_directory, sizeof(ConfigFilePath)); - ink_strlcat(ConfigFilePath, "/", sizeof(ConfigFilePath)); - ink_strlcat(ConfigFilePath, _filename, sizeof(ConfigFilePath)); + config_path = Layout::get()->relative_to(Layout::get()->sysconfdir, _filename); } else { return (UpdateConfigList *) NULL; } - int fd = open(ConfigFilePath, O_RDONLY); + int fd = open(config_path, O_RDONLY); if (fd < 0) { Warning("read update.config, open failed"); SignalWarning(MGMT_SIGNAL_CONFIG_ERROR, "read update.config, open failed"); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/http/HttpBodyFactory.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc index ca0e7f1..632d499 100644 --- a/proxy/http/HttpBodyFactory.cc +++ b/proxy/http/HttpBodyFactory.cc @@ -39,6 +39,7 @@ #include <logging/LogAccess.h> #include <logging/LogAccessHttp.h> #include "HttpCompat.h" +#include "I_Layout.h" ////////////////////////////////////////////////////////////////////// // The HttpBodyFactory creates HTTP response page bodies, supported // @@ -258,11 +259,9 @@ HttpBodyFactory::reconfigure() //#endif { RecInt e; - RecString s; + RecString s = NULL; bool all_found; int rec_err; - struct stat st; - int err; lock(); sanity_check(); @@ -296,27 +295,26 @@ HttpBodyFactory::reconfigure() all_found = all_found && (rec_err == REC_ERR_OKAY); Debug("body_factory", "response_suppression_mode = %d (found = %" PRId64")", response_suppression_mode, e); + xptr<char> directory_of_template_sets; + rec_err = RecGetRecordString_Xmalloc("proxy.config.body_factory.template_sets_dir", &s); all_found = all_found && (rec_err == REC_ERR_OKAY); if (rec_err == REC_ERR_OKAY) { - ats_free(directory_of_template_sets); - directory_of_template_sets = s; - if ((err = stat(directory_of_template_sets, &st)) < 0) { - if ((err = stat(system_config_directory, &st)) < 0) { - Warning("Unable to stat() directory '%s': %d %d, %s", system_config_directory, err, errno, strerror(errno)); - Warning(" Please set 'proxy.config.body_factory.template_sets_dir' "); - } else { - ats_free(directory_of_template_sets); - directory_of_template_sets = ats_strdup(system_config_directory); - } + directory_of_template_sets = Layout::get()->relative(s); + if (access(directory_of_template_sets, R_OK) < 0) { + Warning("Unable to access() directory '%s': %d, %s", (const char *)directory_of_template_sets, errno, strerror(errno)); + Warning(" Please set 'proxy.config.body_factory.template_sets_dir' "); } + } - Debug("body_factory", "directory_of_template_sets = '%s' (found = %" PRId64")", directory_of_template_sets, e); + Debug("body_factory", "directory_of_template_sets = '%s' (found = %s)", (const char *)directory_of_template_sets, s); + ats_free(s); if (!all_found) { Warning("config changed, but can't fetch all proxy.config.body_factory values"); } + ///////////////////////////////////////////// // clear out previous template hash tables // ///////////////////////////////////////////// @@ -353,7 +351,6 @@ HttpBodyFactory::HttpBodyFactory() ink_mutex_init(&mutex, "HttpBodyFactory::lock"); table_of_sets = NULL; - directory_of_template_sets = NULL; enable_customizations = 0; enable_logging = true; callbacks_established = false; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/http/HttpBodyFactory.h ---------------------------------------------------------------------- diff --git a/proxy/http/HttpBodyFactory.h b/proxy/http/HttpBodyFactory.h index b13ac85..4124fcc 100644 --- a/proxy/http/HttpBodyFactory.h +++ b/proxy/http/HttpBodyFactory.h @@ -227,7 +227,6 @@ private: ///////////////////////////////////// int enable_customizations; // 0:no custom,1:custom,2:language-targeted bool enable_logging; // the user wants body factory logging - char *directory_of_template_sets; // root directory for template sets int response_suppression_mode; // when to suppress responses //////////////////// http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/logging/LogConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc index 6cb8e68..5810e8f 100644 --- a/proxy/logging/LogConfig.cc +++ b/proxy/logging/LogConfig.cc @@ -1624,29 +1624,25 @@ static char xml_config_buffer[] = "<LogFilter> \ void LogConfig::read_xml_log_config(int from_memory) { - char config_path[PATH_NAME_MAX]; + xptr<char> config_path; - if (from_memory) { - snprintf(config_path, PATH_NAME_MAX, "%s", "from_memory"); - Debug("log", "Reading from memory %s", config_path); - } else { + if (!from_memory) { if (xml_config_file == NULL) { Note("No log config file to read"); return; } - snprintf(config_path, PATH_NAME_MAX, "%s/%s", system_config_directory, xml_config_file); - } + config_path = Layout::get()->relative_to(Layout::get()->sysconfdir, xml_config_file); + } - Debug("log-config", "Reading log config file %s", config_path); - Debug("xml", "%s is an XML-based config file", config_path); - - InkXmlConfigFile log_config(config_path); + InkXmlConfigFile log_config(config_path ? (const char *)config_path : "memory://builtin"); if (!from_memory) { + Debug("log-config", "Reading log config file %s", (const char *)config_path); + Debug("xml", "%s is an XML-based config file", (const char *)config_path); if (log_config.parse() < 0) { - Note("Error parsing log config file %s; ensure that it is XML-based", config_path); + Note("Error parsing log config file %s; ensure that it is XML-based", (const char *)config_path); return; } @@ -2231,18 +2227,16 @@ LogConfig::read_xml_log_config(int from_memory) char ** LogConfig::read_log_hosts_file(size_t * num_hosts) { - char config_path[PATH_NAME_MAX]; + xptr<char> config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, hosts_config_file)); char line[LOG_MAX_FORMAT_LINE]; char **hosts = NULL; - snprintf(config_path, PATH_NAME_MAX, "%s/%s", system_config_directory, hosts_config_file); - - Debug("log-config", "Reading log hosts from %s", config_path); + Debug("log-config", "Reading log hosts from %s", (const char *)config_path); size_t nhosts = 0; int fd = open(config_path, O_RDONLY); if (fd < 0) { - Warning("Traffic Server can't open %s for reading log hosts " "for splitting: %s.", config_path, strerror(errno)); + Warning("Traffic Server can't open %s for reading log hosts " "for splitting: %s.", (const char *)config_path, strerror(errno)); } else { // // First, count the number of hosts in the file @@ -2261,7 +2255,7 @@ LogConfig::read_log_hosts_file(size_t * num_hosts) // if (nhosts) { if (lseek(fd, 0, SEEK_SET) != 0) { - Warning("lseek failed on file %s: %s", config_path, strerror(errno)); + Warning("lseek failed on file %s: %s", (const char *)config_path, strerror(errno)); nhosts = 0; } else { hosts = NEW(new char *[nhosts]); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/logging/LogStandalone.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc index e731851..5d79f80 100644 --- a/proxy/logging/LogStandalone.cc +++ b/proxy/logging/LogStandalone.cc @@ -56,8 +56,6 @@ int remote_management_flag = 0; int auto_clear_hostdb_flag = 0; char proxy_name[MAXDNAME + 1] = "unknown"; -char system_config_directory[PATH_NAME_MAX + 1] = ""; - char error_tags[1024] = ""; char action_tags[1024] = ""; char command_string[512] = ""; @@ -116,8 +114,6 @@ initialize_process_manager() pmgmt->reconfigure(); - REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX); - // // Define version info records // http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/sac.cc ---------------------------------------------------------------------- diff --git a/proxy/sac.cc b/proxy/sac.cc index e150507..a9e4a9b 100644 --- a/proxy/sac.cc +++ b/proxy/sac.cc @@ -46,21 +46,16 @@ #include "DiagsConfig.h" #include "I_Machine.h" -int auto_clear_cache_flag = 0; - // sac-specific command-line flags // -int version_flag = 0; +static int version_flag = 0; // command-line argument descriptions // -static char configDirectoryType[8] = "S1024"; ArgumentDescription argument_descriptions[] = { {"version", 'V', "Print Version Id", "T", &version_flag, NULL, NULL}, - {"config_dir", 'c', "Config Directory", configDirectoryType, - &system_config_directory, NULL, NULL}, #ifdef DEBUG {"error_tags", 'T', "Colon-Separated Debug Tags", "S1023", &error_tags, NULL, NULL}, @@ -86,7 +81,6 @@ main(int /* argc ATS_UNUSED */, char *argv[]) Layout::create(); // take care of command-line arguments // - snprintf(configDirectoryType, sizeof(configDirectoryType), "S%d", PATH_NAME_MAX - 1); process_args(argument_descriptions, countof(argument_descriptions), argv); // check for the version number request