trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geor...@apache.org
Subject svn commit: r901514 - in /incubator/trafficserver/traffic/branches/dev: iocore/cache/ iocore/hostdb/ libinktomi++/ librecords/ proxy/ proxy/config/ proxy/http2/ proxy/logging/ proxy/mgmt2/ proxy/mgmt2/cli/ proxy/mgmt2/cli2/ proxy/mgmt2/cop/ proxy/mgmt2...
Date Thu, 21 Jan 2010 03:25:30 GMT
Author: georgep
Date: Thu Jan 21 03:24:13 2010
New Revision: 901514

URL: http://svn.apache.org/viewvc?rev=901514&view=rev
Log:
TS-103: This fix allows Traffic Server (TC, TM & TS) to honor the TS_ROOT environment variable setting. 

Modified:
    incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc
    incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h
    incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc
    incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h
    incubator/trafficserver/traffic/branches/dev/librecords/P_RecDefs.h
    incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc
    incubator/trafficserver/traffic/branches/dev/proxy/DiagsConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/InkAPI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
    incubator/trafficserver/traffic/branches/dev/proxy/Main.h
    incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc
    incubator/trafficserver/traffic/branches/dev/proxy/config/storage.config
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpBodyFactory.cc
    incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpProxyServerMain.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logcat.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc
    incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LMRecords.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/MgmtDBM.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/ProcessManager.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/MgmtAllow.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc
    incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc
    incubator/trafficserver/traffic/branches/dev/proxy/sac.cc

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/Cache.cc Thu Jan 21 03:24:13 2010
@@ -2782,6 +2782,8 @@
 void
 ink_cache_init(ModuleVersion v)
 {
+  struct stat s;
+  int ierr;
   ink_release_assert(!checkModuleVersion(v, CACHE_MODULE_VERSION));
 
   cache_rsb = RecAllocateRawStatBlock((int) cache_stat_count);
@@ -2836,6 +2838,20 @@
   IOCORE_RegisterConfigString(RECT_CONFIG, "proxy.config.config_dir", SYSCONFDIR, RECU_DYNAMIC, RECC_NULL, NULL);
   IOCORE_ReadConfigString(cache_system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
   Debug("cache_init", "proxy.config.config_dir = \"%s\"", cache_system_config_directory);
+  if ((ierr = stat(cache_system_config_directory, &s)) < 0) {
+    ink_strncpy(cache_system_config_directory,system_config_directory,PATH_NAME_MAX); 
+    if ((ierr = stat(cache_system_config_directory, &s)) < 0) {
+      // Try 'system_root_dir/etc/trafficserver' directory
+      snprintf(cache_system_config_directory, sizeof(cache_system_config_directory), 
+               "%s%s%s%s%s",system_root_dir, DIR_SEP,"etc",DIR_SEP,"trafficserver");
+      if ((ierr = stat(cache_system_config_directory, &s)) < 0) {
+        fprintf(stderr,"unable to stat() config dir '%s': %d %d, %s\n", 
+                cache_system_config_directory, ierr, errno, strerror(errno));
+        fprintf(stderr, "please set config path via 'proxy.config.config_dir' \n");
+        _exit(1);
+      }
+    }
+  }
 #ifdef HIT_EVACUATE
 
   IOCORE_RegisterConfigInteger(RECT_CONFIG,

Modified: incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/cache/NewCacheVC.h Thu Jan 21 03:24:13 2010
@@ -28,6 +28,7 @@
 #include "api/include/InkAPI.h"
 #include "HTTP.h"
 #include "I_Cache.h"
+#include "P_Cache.h"
 #include "P_CacheHttp.h"
 
 class APIHook;

Modified: incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/hostdb/HostDB.cc Thu Jan 21 03:24:13 2010
@@ -26,7 +26,7 @@
 #include "P_HostDB.h"
 
 #ifndef NON_MODULAR
-char system_config_directory[512] = "conf/yts";
+//char system_config_directory[512] = "conf/yts";
 #else
 #include "Show.h"
 #endif
@@ -330,7 +330,7 @@
       szPath[i] = '\\';
     i++;
   }
-  strcpy(storage_path, system_base_install);
+  strcpy(storage_path, system_root_dir);
   strcat(storage_path, DIR_SEP);
   strcat(storage_path, szPath);
 #else
@@ -338,6 +338,15 @@
 #endif
   IOCORE_ReadConfigInt32(storage_size, "proxy.config.hostdb.storage_size");
 
+  struct stat s;
+  int err;
+  if ((err = stat(storage_path, &s)) < 0) {
+    ink_strncpy(storage_path,system_local_state_dir,PATH_NAME_MAX); 
+    if ((err = stat(storage_path, &s)) < 0) {
+      Warning("Unable to stat() directory '%s': %d %d, %s", storage_path, err, 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);

Modified: incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/iocore/hostdb/MultiCache.cc Thu Jan 21 03:24:13 2010
@@ -34,7 +34,7 @@
 #ifdef NON_MODULAR
 #include "P_HostDB.h"
 #else
-extern const char *system_config_directory;
+//extern const char *system_config_directory;
 #endif
 
 #include "P_MultiCache.h"

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_platform.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_platform.h Thu Jan 21 03:24:13 2010
@@ -171,4 +171,10 @@
 #define MAXINT INT_MAX
 #endif
 
+#ifndef PATH_NAME_MAX
+#define PATH_NAME_MAX 511 // instead of PATH_MAX which is inconsistent
+                          // on various OSs (linux-4096,osx/bsd-1024,
+                          //                 windows-260,etc)
+#endif
+
 #endif /* _PLATFORM_H_ */

Modified: incubator/trafficserver/traffic/branches/dev/librecords/P_RecDefs.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/librecords/P_RecDefs.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/librecords/P_RecDefs.h (original)
+++ incubator/trafficserver/traffic/branches/dev/librecords/P_RecDefs.h Thu Jan 21 03:24:13 2010
@@ -28,13 +28,13 @@
 
 #include "I_RecDefs.h"
 
-#define REC_CONFIG_DIR                 PKGSYSCONFDIR "/"
+#define REC_CONFIG_DIR                 "./etc/trafficserver/"
 #define REC_CONFIG_FILE                "records.config"
 #define REC_SHADOW_EXT                 ".shadow"
-#define REC_RAW_STATS_DIR              PKGLOCALSTATEDIR "/"
+#define REC_RAW_STATS_DIR              "./var/trafficserver/"
 #define REC_RAW_STATS_FILE             "records.snap"
 
-#define REC_PIPE_DIR                   PKGLOCALSTATEDIR
+#define REC_PIPE_DIR                   "./var/trafficserver"
 #define REC_PIPE_NAME                  "librecords_pipe"
 
 #define REC_MESSAGE_ELE_MAGIC           0xF00DF00D

Modified: incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/librecords/RecCore.cc Thu Jan 21 03:24:13 2010
@@ -222,9 +222,9 @@
     g_rec_config_contents_llq = create_queue();
     g_rec_config_contents_ht = ink_hash_table_create(InkHashTableKeyType_String);
     // Import the file into memory; try the following in this order:
-    // ./conf/yts/records.config.shadow
+    // ./etc/trafficserver/records.config.shadow
     // ./records.config.shadow
-    // ./conf/yts/records.config
+    // ./etc/trafficserver/records.config
     // ./records.config
     bool file_exists = true;
     g_rec_config_fpath = REC_CONFIG_DIR REC_CONFIG_FILE REC_SHADOW_EXT;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/DiagsConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/DiagsConfig.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/DiagsConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/DiagsConfig.cc Thu Jan 21 03:24:13 2010
@@ -29,7 +29,7 @@
 #define DIAGS_LOG_FILE "manager.log"
 
 #else
-
+#include "Main.h"
 #include "Config.h"
 #define MGMT_PTR       pmgmt
 #define DIAGS_LOG_FILE "diags.log"
@@ -292,8 +292,9 @@
 DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
 {
   char *diags_logdir = NULL;
-  char diags_logpath[MAXPATHLEN];
-
+  char diags_logpath[PATH_NAME_MAX];
+  struct stat s;
+  int err;
   callbacks_established = false;
   diags_log_fp = (FILE *) NULL;
   diags = NULL;
@@ -314,14 +315,38 @@
   // open the diags log //
   ////////////////////////
 
+  if ((err = stat(system_log_dir, &s)) < 0) {
+    REC_ReadConfigString(system_log_dir, "proxy.config.log2.logfile_dir", PATH_NAME_MAX);
+    if ((err = stat(system_log_dir, &s)) < 0) {
+      diags_logdir = REC_readString("proxy.config.log2.logfile_dir", &found);
+      if (found && (diags_logdir != NULL)) {
+        snprintf(system_log_dir, sizeof(system_log_dir), "%s",diags_logdir);
+      }
+      if ((err = stat(system_log_dir, &s)) < 0) {
+        // Try 'system_root_dir/var/log/trafficserver' directory
+        snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
+                 system_root_dir, DIR_SEP,"var",DIR_SEP,"log",DIR_SEP,"trafficserver");
+        if ((err = stat(system_log_dir, &s)) < 0) {
+          fprintf(stderr,"unable to stat() log dir'%s': %d %d, %s\n", 
+                  system_log_dir, err, errno, strerror(errno));
+          fprintf(stderr,"please set 'proxy.config.log2.logfile_dir'\n");
+          _exit(1);
+        }
+      }
+    }
+  }
+#if 0
   diags_logdir = REC_readString("proxy.config.log2.logfile_dir", &found);
-
   if (!found || (diags_logdir == NULL) || (diags_logdir[0] == '\0')) {
     ink_strncpy(diags_logpath, DIAGS_LOG_FILE, sizeof(diags_logpath));
   } else {
     snprintf(diags_logpath, sizeof(diags_logpath), "%s%s%s", diags_logdir, DIR_SEP, DIAGS_LOG_FILE);
   }
 
+#else
+    snprintf(diags_logpath, sizeof(diags_logpath), "%s%s%s", system_log_dir, DIR_SEP, DIAGS_LOG_FILE);
+#endif
+
   // open write append
   // diags_log_fp = fopen(diags_logpath,"w");
   diags_log_fp = fopen(diags_logpath, "a+");

Modified: incubator/trafficserver/traffic/branches/dev/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/InkAPI.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/InkAPI.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/InkAPI.cc Thu Jan 21 03:24:13 2010
@@ -1816,7 +1816,7 @@
 const char *
 INKInstallDirGet(void)
 {
-  return system_base_install;
+  return system_root_dir;
 }
 
 const char *
@@ -1843,7 +1843,7 @@
     if (*plugin_dir == '/') {
       ink_strncpy(path, plugin_dir, sizeof(path));
     } else {
-      snprintf(path, sizeof(path), "%s%s%s", system_base_install, DIR_SEP, plugin_dir);
+      snprintf(path, sizeof(path), "%s%s%s", system_root_dir, DIR_SEP, plugin_dir);
     }
 
   }

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Main.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Main.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Main.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Main.cc Thu Jan 21 03:24:13 2010
@@ -168,9 +168,13 @@
 char proxy_name[256] = "unknown";
 char command_string[512] = "";
 int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
-char management_directory[256] = PKGSYSCONFDIR;  // e.g. /usr/local/etc/trafficserver
-char system_config_directory[PATH_NAME_MAX + 1] = PKGSYSCONFDIR;  // e.g. /usr/local/etc/trafficserver
-char system_base_install[256] = "";
+char management_directory[256] = DEFAULT_SYSTEM_CONFIG_DIRECTORY;
+
+char system_root_dir[PATH_NAME_MAX + 1] = DEFAULT_ROOT_DIRECTORY;
+char system_local_state_dir[PATH_NAME_MAX + 1] = DEFAULT_LOCAL_STATE_DIRECTORY;
+char system_config_directory[PATH_NAME_MAX + 1] = DEFAULT_SYSTEM_CONFIG_DIRECTORY;
+char system_log_dir[PATH_NAME_MAX + 1] = DEFAULT_LOG_DIRECTORY;
+
 int logging_port_override = 0;
 char logging_server_override[256] = " do not override";
 char error_tags[1024] = "";
@@ -362,12 +366,25 @@
 static void
 check_lockfile()
 {
-  char lockfile[PATH_MAX];
+  char lockfile[PATH_NAME_MAX];
+  char lockdir[PATH_NAME_MAX] = DEFAULT_LOCAL_STATE_DIRECTORY;
   int err;
   pid_t holding_pid;
+  struct stat s;
 
 #ifndef _DLL_FOR_HNS
-  snprintf(lockfile, sizeof(lockfile), PKGLOCALSTATEDIR DIR_SEP SERVER_LOCK);
+  if ((err = stat(lockdir, &s)) < 0) {
+    // Try 'system_root_dir/var/trafficserver' directory
+    snprintf(lockdir, sizeof(lockdir), 
+             "%s%s%s%s%s",system_root_dir, DIR_SEP,"var",DIR_SEP,"trafficserver");
+    if ((err = stat(lockdir, &s)) < 0) {
+      fprintf(stderr,"unable to stat() dir'%s': %d %d, %s\n", 
+                lockdir, err, errno, strerror(errno));
+      fprintf(stderr," please set correct path in env variable TS_ROOT \n");
+      _exit(1);
+    }
+  } 
+  snprintf(lockfile, sizeof(lockfile),"%s%s%s", lockdir,DIR_SEP,SERVER_LOCK);
 #else
 #define MAX_ENVVAR_LENGTH 128
   char tempvar[MAX_ENVVAR_LENGTH + 1];
@@ -395,6 +412,63 @@
   }
 }
 
+static void
+init_dirs(void)
+{
+  struct stat s;
+  int err;
+
+
+  if ((err = stat(system_config_directory, &s)) < 0) {
+    ink_strncpy(system_config_directory,management_directory,PATH_NAME_MAX); 
+    if ((err = stat(system_config_directory, &s)) < 0) {
+      REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
+      if ((err = stat(system_config_directory, &s)) < 0) {
+        // Try 'system_root_dir/etc/trafficserver' directory
+        snprintf(system_config_directory, sizeof(system_config_directory), 
+                 "%s%s%s%s%s",system_root_dir, DIR_SEP,"etc",DIR_SEP,"trafficserver");
+        if ((err = stat(system_config_directory, &s)) < 0) {
+          fprintf(stderr,"unable to stat() config dir '%s': %d %d, %s\n", 
+                    system_config_directory, err, errno, strerror(errno));
+          fprintf(stderr, "please set config path via 'proxy.config.config_dir' \n");
+          _exit(1);
+        }
+      }
+    }
+  }
+
+  if ((err = stat(system_local_state_dir, &s)) < 0) {
+    REC_ReadConfigString(system_local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
+    if ((err = stat(system_local_state_dir, &s)) < 0) {
+      // Try 'system_root_dir/var/trafficserver' directory
+      snprintf(system_local_state_dir, sizeof(system_local_state_dir), 
+               "%s%s%s%s%s",system_root_dir, DIR_SEP,"var",DIR_SEP,"trafficserver");
+      if ((err = stat(system_local_state_dir, &s)) < 0) {
+        fprintf(stderr,"unable to stat() local state dir '%s': %d %d, %s\n", 
+                system_local_state_dir, err, errno, strerror(errno));
+        fprintf(stderr,"please set 'proxy.config.local_state_dir'\n");
+        _exit(1);
+      }
+    }
+  }
+
+  if ((err = stat(system_log_dir, &s)) < 0) {
+    REC_ReadConfigString(system_log_dir, "proxy.config.log2.logfile_dir", PATH_NAME_MAX);
+    if ((err = stat(system_log_dir, &s)) < 0) {
+      // Try 'system_root_dir/var/log/trafficserver' directory
+      snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
+               system_root_dir, DIR_SEP,"var",DIR_SEP,"log",DIR_SEP,"trafficserver");
+      if ((err = stat(system_log_dir, &s)) < 0) {
+        fprintf(stderr,"unable to stat() log dir'%s': %d %d, %s\n", 
+                system_log_dir, err, errno, strerror(errno));
+        fprintf(stderr,"please set 'proxy.config.log2.logfile_dir'\n");
+        _exit(1);
+      }
+    }
+  }
+
+}
+
 //
 // Startup process manager
 //
@@ -402,6 +476,8 @@
 initialize_process_manager()
 {
   ProcessRecords *precs;
+  struct stat s;
+  int err;
 
   mgmt_use_syslog();
 
@@ -415,6 +491,18 @@
   if (management_directory[strlen(management_directory) - 1] == '/')
     management_directory[strlen(management_directory) - 1] = 0;
 
+  if ((err = stat(management_directory, &s)) < 0) {
+    // Try 'system_root_dir/etc/trafficserver' directory
+    snprintf(management_directory, sizeof(management_directory), 
+             "%s%s%s%s%s",system_root_dir, DIR_SEP,"etc",DIR_SEP,"trafficserver");
+    if ((err = stat(management_directory, &s)) < 0) {
+      fprintf(stderr,"unable to stat() management path '%s': %d %d, %s\n", 
+                management_directory, err, errno, strerror(errno));
+      fprintf(stderr,"please set management path via command line '-d <managment directory>'\n");
+      _exit(1);
+    }
+  }
+
   RecProcessInit(remote_management_flag ? RECM_CLIENT : RECM_STAND_ALONE, diags);
 
   if (!remote_management_flag) {
@@ -434,7 +522,8 @@
 
   pmgmt->reconfigure();
 
-  TS_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
+  //TS_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
+  init_dirs();// setup directories
 
   //
   // Define version info records
@@ -1416,16 +1505,41 @@
 }
 #endif //INK_NO_TESTS
 
+
 static void
-find_install_dir(void)
+chdir_root()
 {
-  system_base_install[0] = 0;
-  ink_strncpy(system_base_install, PREFIX, sizeof(system_base_install));
+  char buffer[1024];
+  char *env_path;
+  FILE *ts_file;
+  int i = 0;
 
-  // change the current working directory to the installed directory
-  NOWARN_UNUSED_RETURN(chdir(system_base_install));
+  if ((env_path = getenv("TS_ROOT"))) {
+    strncpy(system_root_dir, env_path, PATH_NAME_MAX);
+  } else {
+    if ((ts_file = fopen("/etc/traffic_server", "r")) != NULL) {
+      NOWARN_UNUSED_RETURN(fgets(buffer, 1024, ts_file));
+      fclose(ts_file);
+      while (!isspace(buffer[i])) {
+        system_root_dir[i] = buffer[i];
+        i++;
+      }
+      system_root_dir[i] = '\0';
+    } else {
+      ink_strncpy(system_root_dir, PREFIX, PATH_NAME_MAX);
+    }
+  }
+
+  if (system_root_dir[0] && (chdir(system_root_dir) < 0)) {
+    fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", system_root_dir, errno, strerror(errno));
+    fprintf(stderr," please set correct path in env variable TS_ROOT \n");
+    _exit(1);
+  } else {
+    printf("[TrafficServer] using root directory '%s'\n",system_root_dir);
+  }
 }
 
+
 int
 getNumSSLThreads(void)
 {
@@ -1580,8 +1694,7 @@
   // Define the version info
   appVersionInfo.setup("traffic_server", PACKAGE_VERSION, __DATE__, __TIME__, BUILD_MACHINE, BUILD_PERSON, "");
 
-  // Find the install root of traffic server.
-  find_install_dir();
+  chdir_root(); // change directory to the install root of traffic server.
 
   process_args(argument_descriptions, n_argument_descriptions, argv);
 
@@ -1681,11 +1794,11 @@
   {
     XMLDom schema;
     bool xmlBandwidthSchemaRead(XMLNode * node);
-    char *configPath = TS_ConfigReadString("proxy.config.config_dir");
+    //char *configPath = TS_ConfigReadString("proxy.config.config_dir");
     char *filename = TS_ConfigReadString("proxy.config.bandwidth_mgmt.filename");
-    char bwFilename[512];
+    char bwFilename[PATH_NAME_MAX];
 
-    snprintf(bwFilename, sizeof(bwFilename), "%s/%s", configPath, filename);
+    snprintf(bwFilename, sizeof(bwFilename), "%s/%s", system_config_directory, filename);
 
 
     Debug("bw-mgmt", "Looking to read: %s for bw-mgmt", bwFilename);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/Main.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/Main.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/Main.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/Main.h Thu Jan 21 03:24:13 2010
@@ -46,6 +46,11 @@
 
 #define ET_CACHE ET_CALL
 
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+
 //
 // Global Data
 //
@@ -70,8 +75,10 @@
 
 extern int remote_management_flag;
 extern char management_directory[256];
+extern char system_root_dir[PATH_NAME_MAX + 1];
+extern char system_local_state_dir[PATH_NAME_MAX + 1];
 extern char system_config_directory[PATH_NAME_MAX + 1];
-extern char system_base_install[256];
+extern char system_log_dir[PATH_NAME_MAX + 1];
 
 inkcoreapi extern int qt_accept_file_descriptor;
 inkcoreapi extern int CacheClusteringEnabled;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/StatSystem.cc Thu Jan 21 03:24:13 2010
@@ -613,8 +613,11 @@
   // Jira TS-21
   REC_ReadConfigString(local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
   if ((err = stat(local_state_dir, &s)) < 0) {
-    Warning("Unable to stat() local state directory '%s': %d %d, %s", local_state_dir, err, errno, strerror(errno));
-    Warning(" Please set 'proxy.config.local_state_dir' to allow statistics collection");
+    ink_strncpy(local_state_dir,system_local_state_dir,PATH_NAME_MAX); 
+    if ((err = stat(local_state_dir, &s)) < 0) {
+      Warning("Unable to stat() local state directory '%s': %d %d, %s", local_state_dir, err, 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);
   snprintf(snap_filename, sizeof(snap_filename), "%s%s%s", local_state_dir,

Modified: incubator/trafficserver/traffic/branches/dev/proxy/config/storage.config
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/config/storage.config?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/config/storage.config (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/config/storage.config Thu Jan 21 03:24:13 2010
@@ -17,6 +17,7 @@
 # Example: 128MB cache file(/usr/local/trafficserver/cache/cache.db)
 #
 /usr/local/trafficserver/cache 134217728
+#. 536870912
 #
 #
 #############################################################

Modified: incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpBodyFactory.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpBodyFactory.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpBodyFactory.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpBodyFactory.cc Thu Jan 21 03:24:13 2010
@@ -278,6 +278,8 @@
   RecString s;
   bool all_found;
   int rec_err;
+  struct stat st;
+  int err;
 
   lock();
   sanity_check();
@@ -318,6 +320,15 @@
       xfree(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 {
+        xfree(directory_of_template_sets);
+        directory_of_template_sets = xstrdup(system_config_directory);
+      }
+    }
   }
 
   Debug("body_factory", "directory_of_template_sets = '%s' (found = %d)", directory_of_template_sets, e);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpProxyServerMain.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpProxyServerMain.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpProxyServerMain.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/http2/HttpProxyServerMain.cc Thu Jan 21 03:24:13 2010
@@ -213,7 +213,7 @@
   ////////////////////////////////
   if ((port<1) || (port> 65535)) {
 
-    ProcessFatal("accept port is not between 1 and 65535 ", "please check configuration");
+    ProcessFatal("accept port %d is not between 1 and 65535 ", "please check configuration", port);
     return;
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logcat.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logcat.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logcat.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logcat.cc Thu Jan 21 03:24:13 2010
@@ -45,6 +45,9 @@
 #include "LogSock.h"
 #include "Log.h"
 
+char system_local_state_dir[PATH_NAME_MAX + 1] = DEFAULT_LOCAL_STATE_DIRECTORY;
+char system_log_dir[PATH_NAME_MAX + 1] = DEFAULT_LOG_DIRECTORY;
+
 // logcat-specific command-line flags
 static int version_flag = 0;
 static int help = 0;
@@ -85,6 +88,7 @@
   "Vw2] [input-file ...]";
 
 
+
 int
 process_file(int in_fd, int out_fd)
 {

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogConfig.cc Thu Jan 21 03:24:13 2010
@@ -212,6 +212,8 @@
 {
   int val;
   char *ptr;
+  struct stat s;
+  int err;
 
   val = (int) LOG_ConfigReadInteger("proxy.config.log2.log_buffer_size");
   if (val > 0) {
@@ -286,7 +288,24 @@
   if (ptr != NULL) {
     xfree(logfile_dir);
     logfile_dir = ptr;
-  };
+    if ((err = stat(logfile_dir, &s)) < 0) {
+      xfree(logfile_dir);
+      logfile_dir = NULL;
+      if ((err = stat(system_log_dir, &s)) < 0) {
+        // Try 'system_root_dir/var/log/trafficserver' directory
+        snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
+                 system_root_dir, DIR_SEP,"var",DIR_SEP,"log",DIR_SEP,"trafficserver");
+        if ((err = stat(system_log_dir, &s)) < 0) {
+          fprintf(stderr,"unable to stat() log dir'%s': %d %d, %s\n", 
+                  system_log_dir, err, errno, strerror(errno));
+          fprintf(stderr,"please set 'proxy.config.log2.logfile_dir'\n");
+          _exit(1);
+        } 
+
+      } 
+      logfile_dir = xstrdup(system_log_dir);
+    }
+  }
 
 
   //

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logging/LogStandalone.cc Thu Jan 21 03:24:13 2010
@@ -65,7 +65,7 @@
 char error_tags[1024] = "";
 char action_tags[1024] = "";
 char command_string[512] = "";
-char system_base_install[256] = "";
+char system_root_dir[PATH_NAME_MAX + 1] = DEFAULT_ROOT_DIRECTORY;
 
 Diags *diags = NULL;
 DiagsConfig *diagsConfig = NULL;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/logstats.cc Thu Jan 21 03:24:13 2010
@@ -55,6 +55,12 @@
 // Constants, please update the VERSION number when you make a new build!!!
 #define PROGRAM_VERSION		"1.0"
 #define PROGRAM_NAME		"logstats"
+
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+
 const int MAX_LOGBUFFER_SIZE = 65536;
 const int DEFAULT_LINE_LEN = 78;
 const double LOG10_1024 = 3.0102999566398116;
@@ -86,10 +92,10 @@
 // Defaults/string constants
 
 // e.g. /usr/local/var/log/trafficserver/logstats.state
-const static char *STATE_FILE = PKGLOGDIR "/logstats.state";
+const static char *STATE_FILE = DEFAULT_LOG_DIRECTORY "/logstats.state";
 
 // e.g. /usr/local/var/log/trafficserver
-const static char *LOG_DIR = PKGLOGDIR;
+const static char *LOG_DIR = DEFAULT_LOG_DIRECTORY;
 
 
 // Store our "state" (position in log file etc.)
@@ -281,6 +287,8 @@
 typedef hash_map < const char *, OriginStats *, hash < const char *>, eqstr > OriginStorage;
 typedef hash_set < const char *, hash < const char *>, eqstr > OriginSet;
 
+char system_local_state_dir[PATH_NAME_MAX + 1] = DEFAULT_LOCAL_STATE_DIRECTORY;
+char system_log_dir[PATH_NAME_MAX + 1] = DEFAULT_LOG_DIRECTORY;
 
 ///////////////////////////////////////////////////////////////////////////////
 // Globals, holding the accumulated stats (ok, I'm lazy ...)
@@ -1860,7 +1868,7 @@
 
   // Change directory to the log dir
   if (chdir(LOG_DIR) < 0) {
-    strncat(ymon_notice, " can't chdir to " PKGLOGDIR, sizeof(ymon_notice) - strlen(ymon_notice) - 1);
+    strncat(ymon_notice, " can't chdir to " DEFAULT_LOG_DIRECTORY, sizeof(ymon_notice) - strlen(ymon_notice) - 1);
     my_exit(YMON_CRITICAL, ymon_notice);
   }
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.cc Thu Jan 21 03:24:13 2010
@@ -35,6 +35,7 @@
 #include "Compatability.h"
 #include "ink_string.h"
 #include "ink_atomic.h"
+#include "Main.h"
 #include "BaseRecords.h"
 #include "RecordsConfig.h"
 #include "MgmtSocket.h"
@@ -86,7 +87,7 @@
 
 BaseRecords::BaseRecords(char *mpath, char *cfile, char *efile)
 {
-  char fpath[1024];
+  char fpath[PATH_NAME_MAX];
   InkHashTableEntry *hash_entry;
   InkHashTableIteratorState hash_iterator_state;
 
@@ -126,7 +127,8 @@
   plugin_data.recs = (Record *) xmalloc(MAX_PLUGIN_RECORDS * sizeof(Record));
 
   /* For now, we are using a dbm for record sharing */
-  snprintf(fpath, sizeof(fpath), "%s", MGMT_DB_FILENAME);
+  snprintf(fpath, sizeof(fpath), "%s%s%s", system_local_state_dir,DIR_SEP,MGMT_DB_FILENAME);
+  unlink(fpath);
   record_db = new MgmtDBM(fpath);
 
   /* Setup RecordType->record_array mappings */

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/BaseRecords.h Thu Jan 21 03:24:13 2010
@@ -235,7 +235,7 @@
   long pid;
   char str_pid[1024];
   MgmtDBM *record_db;
-  char config_file[80];
+  char config_file[PATH_NAME_MAX + 1];
 
   MgmtHashTable *record_files;
   MgmtHashTable *record_id_map;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/FileManager.cc Thu Jan 21 03:24:13 2010
@@ -70,9 +70,10 @@
 
 FileManager::FileManager()
 {
-  char configTmp[256];
+  char configTmp[PATH_NAME_MAX];
   int pathLen;
   struct stat statBuf;
+  int err;
 
   bindings = ink_hash_table_create(InkHashTableKeyType_String);
 
@@ -85,6 +86,15 @@
     mgmt_fatal(stderr,
                "[FileManager::FileManager] Unable to find configuration directory from proxy.config.config_dir\n");
   }
+  if ((err = stat(configTmp, &statBuf)) < 0) {
+    ink_strncpy(configTmp, system_config_directory,PATH_NAME_MAX); 
+    if ((err = stat(configTmp, &statBuf)) < 0) {
+        mgmt_elog("[FileManager::FileManager] unable to stat() directory '%s': %d %d, %s\n", 
+                mgmt_path, err, errno, strerror(errno));
+        mgmt_elog("[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;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LMRecords.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LMRecords.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LMRecords.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LMRecords.h Thu Jan 21 03:24:13 2010
@@ -45,10 +45,10 @@
 
   LMRecords(char *mpath, char *cfile, char *efile):BaseRecords(mpath, cfile, efile)
   {
-    char fpath[1024];
-      time_last_config_change = 0;
-      snprintf(fpath, sizeof(fpath), "%s", MGMT_DB_FILENAME);
-      unlink(fpath);
+    //char fpath[PATH_NAME_MAX];
+    time_last_config_change = 0;
+    //snprintf(fpath, sizeof(fpath), "%s%s%s", system_local_state_dir,DIR_SEP,MGMT_DB_FILENAME);
+    //unlink(fpath);
   };
   ~LMRecords() {
   };

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.cc Thu Jan 21 03:24:13 2010
@@ -235,7 +235,8 @@
 BaseManager(), run_proxy(proxy_on), record_data(rd)
 {
   bool found;
-
+  struct stat s;
+  int err;
 #ifdef MGMT_USE_SYSLOG
   syslog_facility = 0;
 #endif
@@ -371,6 +372,16 @@
     proxy_server_incoming_ip_to_bind = htonl(INADDR_ANY);
   }
   config_path = REC_readString("proxy.config.config_dir", &found);
+  if ((err = stat(config_path, &s)) < 0) {
+    xfree(config_path);
+    config_path = xstrdup(system_config_directory);
+    if ((err = stat(config_path, &s)) < 0) {
+        mgmt_elog("[LocalManager::LocalManager] unable to stat() directory '%s': %d %d, %s\n", 
+                config_path, err, errno, strerror(errno));
+        mgmt_fatal("[LocalManager::LocalManager] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
+    }
+  }
+
   bin_path = REC_readString("proxy.config.bin_path", &found);
   process_server_timeout_secs = REC_readInteger("proxy.config.lm.pserver_timeout_secs", &found);
   process_server_timeout_msecs = REC_readInteger("proxy.config.lm.pserver_timeout_msecs", &found);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/LocalManager.h Thu Jan 21 03:24:13 2010
@@ -148,7 +148,7 @@
   int process_server_timeout_secs;
   int process_server_timeout_msecs;
 
-  char pserver_path[1024];
+  char pserver_path[PATH_NAME_MAX];
   char *config_path;
   char *bin_path;
   char *absolute_proxy_binary;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.cc Thu Jan 21 03:24:13 2010
@@ -293,13 +293,14 @@
 }
 
 static void
-init_dirs(void)
+init_dirs(bool use_librecords = true)
 {
   struct stat s;
   int err;
 
   if ((err = stat(mgmt_path, &s)) < 0) {
-    REC_ReadConfigString(mgmt_path, "proxy.config.config_dir", PATH_NAME_MAX);
+    if (use_librecords)
+      REC_ReadConfigString(mgmt_path, "proxy.config.config_dir", PATH_NAME_MAX);
     if ((err = stat(mgmt_path, &s)) < 0) {
       // Try 'system_root_dir/etc/trafficserver' directory
       snprintf(mgmt_path, sizeof(mgmt_path), 
@@ -316,7 +317,8 @@
   if ((err = stat(system_config_directory, &s)) < 0) {
     ink_strncpy(system_config_directory,mgmt_path,PATH_NAME_MAX); 
     if ((err = stat(system_config_directory, &s)) < 0) {
-      REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
+      if (use_librecords)
+        REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
       if ((err = stat(system_config_directory, &s)) < 0) {
         // Try 'system_root_dir/etc/trafficserver' directory
         snprintf(system_config_directory, sizeof(system_config_directory), 
@@ -332,7 +334,8 @@
   }
 
   if ((err = stat(system_local_state_dir, &s)) < 0) {
-    REC_ReadConfigString(system_local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
+    if (use_librecords)
+      REC_ReadConfigString(system_local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
     if ((err = stat(system_local_state_dir, &s)) < 0) {
       // Try 'system_root_dir/var/trafficserver' directory
       snprintf(system_local_state_dir, sizeof(system_local_state_dir), 
@@ -347,7 +350,8 @@
   }
 
   if ((err = stat(system_log_dir, &s)) < 0) {
-    REC_ReadConfigString(system_log_dir, "proxy.config.log2.logfile_dir", PATH_NAME_MAX);
+    if (use_librecords)
+      REC_ReadConfigString(system_log_dir, "proxy.config.log2.logfile_dir", PATH_NAME_MAX);
     if ((err = stat(system_log_dir, &s)) < 0) {
       // Try 'system_root_dir/var/log/trafficserver' directory
       snprintf(system_log_dir, sizeof(system_log_dir), "%s%s%s%s%s%s%s",
@@ -391,6 +395,8 @@
     mgmt_elog("unable to change to root directory \"%s\" [%d '%s']\n", system_root_dir, errno, strerror(errno));
     mgmt_elog(" please set correct path in env variable TS_ROOT \n");
     exit(1);
+  } else {
+    mgmt_log("[TrafficManager] using root directory '%s'\n",system_root_dir);
   }
 }
 
@@ -595,7 +601,7 @@
     icmp_ping = new MgmtPing(); */
   icmp_ping = NULL;
 
-  init_dirs();// setup directories
+  init_dirs(false);// setup directories
 
   // Get the config info we need while we are still root
   extractConfigInfo(mgmt_path, recs_conf, userToRunAs);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Main.h Thu Jan 21 03:24:13 2010
@@ -36,9 +36,9 @@
                                   //                 windows-260,etc)
 
 #define DEFAULT_ROOT_DIRECTORY            PREFIX
-#define DEFAULT_LOCAL_STATE_DIRECTORY     PKGLOCALSTATEDIR
-#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   PKGSYSCONFDIR
-#define DEFAULT_LOG_DIRECTORY             PKGLOGDIR
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
 
 void MgmtShutdown(int status);
 void fileUpdated(char *fname);
@@ -62,7 +62,7 @@
 extern char system_root_dir[];
 extern char system_local_state_dir[];
 extern char system_config_directory[];
-extern char system_log_dir[];
+extern char system_log_dir[PATH_NAME_MAX + 1];
 
 
 // Global variable to replace ifdef MGMT_LAUNCH_PROXY so that

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/MgmtDBM.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/MgmtDBM.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/MgmtDBM.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/MgmtDBM.h Thu Jan 21 03:24:13 2010
@@ -62,7 +62,7 @@
 
   MgmtDBM(char *fname):SimpleDBM(), mgmt_sem_id(0)
   {
-    if (!(strlen(fname) < 80)) {
+    if (!(strlen(fname) < PATH_NAME_MAX)) {
       mgmt_fatal(stderr, "[MgmtDBM::MgmtDBM] File name to large: '%s'\n", fname);
     }
     partner_process = 0;
@@ -240,7 +240,7 @@
 #else
   HANDLE mgmt_hsem;
 #endif
-  char db_file[80];
+  char db_file[PATH_NAME_MAX + 1];
   pid_t partner_process;
 
 };                              /* End class MgmtDBM */

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/ProcessManager.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/ProcessManager.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/ProcessManager.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/ProcessManager.cc Thu Jan 21 03:24:13 2010
@@ -43,6 +43,10 @@
 #include "ink_apidefs.h"
 #include "MgmtSocket.h"
 
+#ifndef DEFAULT_LOCAL_STATE_DIRECTORY // FIXME: consolidate defines
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
+#endif
+
 /*
  * Global ProcessManager
  */
@@ -84,7 +88,7 @@
 ProcessManager::ProcessManager(bool rlm, char *mpath, ProcessRecords * rd):
 BaseManager(), require_lm(rlm), mgmt_sync_key(0), record_data(rd), local_manager_sockfd(0)
 {
-  ink_strncpy(pserver_path, PKGLOCALSTATEDIR, sizeof(pserver_path));
+  ink_strncpy(pserver_path, DEFAULT_LOCAL_STATE_DIRECTORY, sizeof(pserver_path));
   mgmt_signal_queue = create_queue();
 
   // Set temp. process/manager timeout. Will be reconfigure later.

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/RecordsConfig.cc Thu Jan 21 03:24:13 2010
@@ -24,6 +24,7 @@
 
 
 #include "RecordsConfig.h"
+#include "Main.h"
 
 //-------------------------------------------------------------------------
 // RecordsConfig
@@ -58,7 +59,7 @@
 
   {CONFIG, "proxy.config.proxy_name", "", INK_STRING, "<proxy_name>", RU_REREAD, RR_REQUIRED, RC_STR, ".+", RA_NULL}
   ,
-  {CONFIG, "proxy.config.bin_path", "", INK_STRING, PREFIX "/bin", RU_NULL, RR_REQUIRED, RC_NULL, NULL, RA_NULL}
+  {CONFIG, "proxy.config.bin_path", "", INK_STRING, "./bin", RU_NULL, RR_REQUIRED, RC_NULL, NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.proxy_binary", "", INK_STRING, "traffic_server", RU_NULL, RR_REQUIRED, RC_NULL, NULL, RA_NULL}
   ,
@@ -295,13 +296,13 @@
   //# 1 is full clustering, 2 is mgmt only, 3 is no clustering
   {LOCAL, "proxy.local.cluster.type", "", INK_INT, "3", RU_RESTART_TM, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.cluster.rsport", "", INK_INT, "<reliable_service_port>", RU_NULL, RR_REQUIRED, RC_NULL, NULL,
+  {CONFIG, "proxy.config.cluster.rsport", "", INK_INT, "8088", RU_NULL, RR_REQUIRED, RC_NULL, NULL,
    RA_NULL}
   ,
-  {CONFIG, "proxy.config.cluster.mcport", "", INK_INT, "<multicast_port>", RU_REREAD, RR_REQUIRED, RC_NULL, NULL,
+  {CONFIG, "proxy.config.cluster.mcport", "", INK_INT, "8089", RU_REREAD, RR_REQUIRED, RC_NULL, NULL,
    RA_NULL}
   ,
-  {CONFIG, "proxy.config.cluster.mc_group_addr", "", INK_STRING, "<multicast_group_addr>", RU_REREAD, RR_REQUIRED,
+  {CONFIG, "proxy.config.cluster.mc_group_addr", "", INK_STRING, "224.0.1.37", RU_REREAD, RR_REQUIRED,
    RC_IP, "[0-255].[0-255].[0-255].[0-255]", RA_NULL}
   ,
   {CONFIG, "proxy.config.cluster.mc_ttl", "", INK_INT, "1", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}
@@ -311,10 +312,10 @@
   {CONFIG, "proxy.config.admin.html_doc_root", "", INK_STRING, "<html_doc_root>", RU_NULL, RR_REQUIRED, RC_NULL, NULL,
    RA_NULL}
   ,
-  {CONFIG, "proxy.config.admin.web_interface_port", "", INK_INT, "<web_interface_port>", RU_RESTART_TM, RR_REQUIRED,
+  {CONFIG, "proxy.config.admin.web_interface_port", "", INK_INT, "8081", RU_RESTART_TM, RR_REQUIRED,
    RC_INT, "[0-65535]", RA_NULL}
   ,
-  {CONFIG, "proxy.config.admin.autoconf_port", "", INK_INT, "<auto_config_port>", RU_RESTART_TM, RR_REQUIRED, RC_INT,
+  {CONFIG, "proxy.config.admin.autoconf_port", "", INK_INT, "8083", RU_RESTART_TM, RR_REQUIRED, RC_INT,
    "[0-65535]", RA_NULL}
   ,
   {CONFIG, "proxy.config.admin.autoconf.localhost_only", "", INK_INT, "0", RU_RESTART_TM, RR_NULL, RC_INT, "[0-1]",
@@ -329,7 +330,7 @@
   // overseer_mode: 0 disabled, 1 monitor only (get), 2 full acces (get, set, reread, bounce, restart)
   {CONFIG, "proxy.config.admin.overseer_mode", "", INK_INT, "1", RU_RESTART_TM, RR_NULL, RC_INT, "[0-2]", RA_NULL}
   ,
-  {CONFIG, "proxy.config.admin.overseer_port", "", INK_INT, "<overseer_port>", RU_NULL, RR_REQUIRED, RC_NULL, NULL,
+  {CONFIG, "proxy.config.admin.overseer_port", "", INK_INT, "9898", RU_NULL, RR_REQUIRED, RC_NULL, NULL,
    RA_NULL}
   ,
   {CONFIG, "proxy.config.admin.admin_user", "", INK_STRING, "<admin_user_name>", RU_REREAD, RR_REQUIRED, RC_STR, ".+",
@@ -369,7 +370,7 @@
   ,
   {CONFIG, "proxy.config.admin.cli_enabled", "", INK_INT, "1", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.admin.cli_path", "", INK_STRING, PKGLOCALSTATEDIR "/cli", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
+  {CONFIG, "proxy.config.admin.cli_path", "", INK_STRING, DEFAULT_LOCAL_STATE_DIRECTORY "/cli", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.admin.cli_port", "", INK_INT, "9000", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
@@ -410,7 +411,7 @@
   ,
   {CONFIG, "proxy.config.process_manager.enable_mgmt_port", "", INK_INT, "1", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.process_manager.mgmt_port", "", INK_INT, "<process_mgmt_port>", RU_NULL, RR_REQUIRED, RC_NULL,
+  {CONFIG, "proxy.config.process_manager.mgmt_port", "", INK_INT, "8084", RU_NULL, RR_REQUIRED, RC_NULL,
    NULL, RA_NULL}
   ,
   //##############################################################################
@@ -559,7 +560,7 @@
    "authcache.db", RU_RESTART_TS, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.auth.cache.path", "", INK_STRING,
-   PKGLOCALSTATEDIR, RU_RESTART_TS, RR_NULL, RC_NULL, NULL, RA_NULL}
+   DEFAULT_LOCAL_STATE_DIRECTORY, RU_RESTART_TS, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.auth.cache.size", "", INK_INT, "5000",
    RU_RESTART_TS, RR_NULL, RC_NULL, NULL, RA_NULL}
@@ -586,7 +587,7 @@
   {CONFIG, "proxy.config.auth.convert_bin", "", INK_STRING, "filter_to_policy", RU_REREAD, RR_NULL, RC_STR, ".*",
    RA_NULL}
   ,
-  {CONFIG, "proxy.config.auth.password_file_path", "", INK_STRING, PKGLOCALSTATEDIR, RU_REREAD, RR_NULL, RC_NULL,
+  {CONFIG, "proxy.config.auth.password_file_path", "", INK_STRING, DEFAULT_LOCAL_STATE_DIRECTORY, RU_REREAD, RR_NULL, RC_NULL,
    ".*", RA_NULL}
   ,
   //##############################################################################x
@@ -600,7 +601,7 @@
   ,
   {CONFIG, "proxy.config.ldap.cache.size", "", INK_INT, "5000", RU_RESTART_TS, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.ldap.cache.storage_path", "", INK_STRING, PKGLOCALSTATEDIR, RU_RESTART_TS, RR_NULL, RC_NULL,
+  {CONFIG, "proxy.config.ldap.cache.storage_path", "", INK_STRING, DEFAULT_LOCAL_STATE_DIRECTORY, RU_RESTART_TS, RR_NULL, RC_NULL,
    NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.ldap.cache.storage_size", "", INK_INT, "15728640", RU_RESTART_TS, RR_NULL, RC_NULL, NULL,
@@ -721,7 +722,7 @@
   ,
   {CONFIG, "proxy.config.ntlm.cache.size", "", INK_INT, "5000", RU_RESTART_TS, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.ntlm.cache.storage_path", "", INK_STRING, PKGLOCALSTATEDIR, RU_RESTART_TS, RR_NULL, RC_NULL,
+  {CONFIG, "proxy.config.ntlm.cache.storage_path", "", INK_STRING, DEFAULT_LOCAL_STATE_DIRECTORY, RU_RESTART_TS, RR_NULL, RC_NULL,
    NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.ntlm.cache.storage_size", "", INK_INT, "15728640", RU_RESTART_TS, RR_NULL, RC_NULL, NULL,
@@ -808,7 +809,7 @@
   ,
   {CONFIG, "proxy.config.username.cache.size", "", INK_INT, "5000", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.username.cache.storage_path", "", INK_STRING, PKGLOCALSTATEDIR, RU_NULL, RR_NULL, RC_NULL,
+  {CONFIG, "proxy.config.username.cache.storage_path", "", INK_STRING, DEFAULT_LOCAL_STATE_DIRECTORY, RU_NULL, RR_NULL, RC_NULL,
    NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.username.cache.storage_size", "", INK_INT, "15728640", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
@@ -830,7 +831,7 @@
   //       #
   {CONFIG, "proxy.config.http.enabled", "", INK_INT, "1", RU_RESTART_TM, RR_NULL, RC_INT, "[0-1]", RA_NULL}
   ,
-  {CONFIG, "proxy.config.http.server_port", "", INK_INT, "<server_port>", RU_RESTART_TM, RR_REQUIRED, RC_INT,
+  {CONFIG, "proxy.config.http.server_port", "", INK_INT, "8080", RU_RESTART_TM, RR_REQUIRED, RC_INT,
    "[0-65535]", RA_NULL}
   ,
   {CONFIG, "proxy.config.http.server_port_attr", "", INK_STRING, "X", RU_RESTART_TM, RR_NULL, RC_NULL, NULL, RA_NULL}
@@ -1282,7 +1283,7 @@
   {CONFIG, "proxy.config.body_factory.enable_logging", "", INK_INT, "1", RU_RESTART_TS, RR_NULL, RC_INT, "[0-1]",
    RA_NULL}
   ,
-  {CONFIG, "proxy.config.body_factory.template_sets_dir", "", INK_STRING, PKGSYSCONFDIR "/body_factory", RU_RESTART_TS,
+  {CONFIG, "proxy.config.body_factory.template_sets_dir", "", INK_STRING, DEFAULT_SYSTEM_CONFIG_DIRECTORY "/body_factory", RU_RESTART_TS,
    RR_NULL, RC_STR, "^[^[:space:]]+$", RA_NULL}
   ,
   //# 0 - never suppress generated responses
@@ -2187,7 +2188,7 @@
   //# Cluster Subsystem
   //#
   //##############################################################################
-  {CONFIG, "proxy.config.cluster.cluster_port", "", INK_INT, "<cluster_port>", RU_RESTART_TS, RR_REQUIRED, RC_NULL,
+  {CONFIG, "proxy.config.cluster.cluster_port", "", INK_INT, "8086", RU_RESTART_TS, RR_REQUIRED, RC_NULL,
    NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.cluster.cluster_configuration", "", INK_STRING, "cluster.config", RU_NULL, RR_NULL, RC_NULL,
@@ -2625,7 +2626,7 @@
   //       # in entries, may not be changed while running
   {CONFIG, "proxy.config.hostdb.size", "", INK_INT, "200000", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.hostdb.storage_path", "", INK_STRING, PKGLOCALSTATEDIR, RU_REREAD, RR_NULL, RC_NULL, NULL,
+  {CONFIG, "proxy.config.hostdb.storage_path", "", INK_STRING, DEFAULT_LOCAL_STATE_DIRECTORY, RU_REREAD, RR_NULL, RC_NULL, NULL,
    RA_NULL}
   ,
   {CONFIG, "proxy.config.hostdb.storage_size", "", INK_INT, "33554432", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}
@@ -2728,7 +2729,7 @@
   ,
   {CONFIG, "proxy.config.log2.hostname", "", INK_STRING, "localhost", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.log2.logfile_dir", "", INK_STRING, PKGLOGDIR , RU_REREAD, RR_NULL, RC_STR, "^[^[:space:]]+$",
+  {CONFIG, "proxy.config.log2.logfile_dir", "", INK_STRING, DEFAULT_LOG_DIRECTORY, RU_REREAD, RR_NULL, RC_STR, "^[^[:space:]]+$",
    RA_NULL}
   ,
   {CONFIG, "proxy.config.log2.logfile_perm", "", INK_STRING, "rw-r--r--", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}
@@ -2792,7 +2793,7 @@
   {CONFIG, "proxy.config.log2.collation_host", "", INK_STRING, NULL, RU_REREAD, RR_NULL, RC_STR, "^[^[:space:]]*$",
    RA_NULL}
   ,
-  {CONFIG, "proxy.config.log2.collation_port", "", INK_INT, "<log2_collation_port>", RU_REREAD, RR_REQUIRED, RC_INT,
+  {CONFIG, "proxy.config.log2.collation_port", "", INK_INT, "8085", RU_REREAD, RR_REQUIRED, RC_INT,
    "[0-65535]", RA_NULL}
   ,
   {CONFIG, "proxy.config.log2.collation_secret", "", INK_STRING, "foobar", RU_REREAD, RR_NULL, RC_STR, ".*", RA_NULL}
@@ -3336,10 +3337,10 @@
   ,
   {CONFIG, "proxy.config.aaa.radius.min_timeout", "", INK_INT, "10", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.aaa.radius.database_path", "", INK_STRING, PKGSYSCONFDIR "/plugins/aaa/raddb", RU_NULL, RR_NULL,
+  {CONFIG, "proxy.config.aaa.radius.database_path", "", INK_STRING, DEFAULT_SYSTEM_CONFIG_DIRECTORY "/plugins/aaa/raddb", RU_NULL, RR_NULL,
    RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.aaa.radius.log_path", "", INK_STRING, PKGLOGDIR, RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
+  {CONFIG, "proxy.config.aaa.radius.log_path", "", INK_STRING, DEFAULT_LOG_DIRECTORY, RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
 
   //##############################################################################
@@ -3423,7 +3424,7 @@
   {CONFIG, "proxy.config.ssl.server.cert.filename", "", INK_STRING, "server.pem", RU_RESTART_TS, RR_NULL, RC_STR,
    "^[^[:space:]]+$", RA_NULL}
   ,
-  {CONFIG, "proxy.config.ssl.server.cert.path", "", INK_STRING, PKGSYSCONFDIR, RU_RESTART_TS, RR_NULL, RC_NULL, NULL,
+  {CONFIG, "proxy.config.ssl.server.cert.path", "", INK_STRING, DEFAULT_SYSTEM_CONFIG_DIRECTORY, RU_RESTART_TS, RR_NULL, RC_NULL, NULL,
    RA_NULL}
   ,
   {CONFIG, "proxy.config.ssl.server.cert_chain.filename", "", INK_STRING, NULL, RU_RESTART_TS, RR_NULL, RC_STR, NULL,
@@ -3448,7 +3449,7 @@
   {CONFIG, "proxy.config.ssl.client.cert.filename", "", INK_STRING, NULL, RU_RESTART_TS, RR_NULL, RC_STR,
    "^[^[:space:]]*$", RA_NULL}
   ,
-  {CONFIG, "proxy.config.ssl.client.cert.path", "", INK_STRING, PKGSYSCONFDIR, RU_RESTART_TS, RR_NULL, RC_NULL, NULL,
+  {CONFIG, "proxy.config.ssl.client.cert.path", "", INK_STRING, DEFAULT_SYSTEM_CONFIG_DIRECTORY, RU_RESTART_TS, RR_NULL, RC_NULL, NULL,
    RA_NULL}
   ,
   {CONFIG, "proxy.config.ssl.client.private_key.filename", "", INK_STRING, NULL, RU_RESTART_TS, RR_NULL, RC_STR,
@@ -3601,11 +3602,11 @@
   //# Directory in which to find plugins
   {CONFIG, "proxy.config.plugin.plugin_dir", "", INK_STRING, PKGLIBEXECDIR, RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
-  {CONFIG, "proxy.config.plugin.plugin_mgmt_dir", "", INK_STRING, PKGSYSCONFDIR "/plugins_mgmt", RU_NULL, RR_NULL, RC_NULL,
+  {CONFIG, "proxy.config.plugin.plugin_mgmt_dir", "", INK_STRING, DEFAULT_SYSTEM_CONFIG_DIRECTORY "/plugins_mgmt", RU_NULL, RR_NULL, RC_NULL,
    NULL, RA_NULL}
   ,
   {CONFIG, "proxy.config.plugin.extensions_dir", "", INK_STRING,
-   PKGLOCALSTATEDIR, RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
+   DEFAULT_LOCAL_STATE_DIRECTORY, RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
   ,
 
   //##############################################################################

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/Rollback.cc Thu Jan 21 03:24:13 2010
@@ -59,12 +59,14 @@
   :
 root_access_needed(root_access_needed_)
 {
-  char configTmp[256];
+  char configTmp[PATH_NAME_MAX];
   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
@@ -89,6 +91,16 @@
     ink_assert(0);
   }
 
+  if ((err = stat(configTmp, &s)) < 0) {
+    ink_strncpy(configTmp, system_config_directory,PATH_NAME_MAX); 
+    if ((err = stat(configTmp, &s)) < 0) {
+        mgmt_elog("[Rollback::Rollback] unable to stat() directory '%s': %d %d, %s\n", 
+                mgmt_path, err, errno, strerror(errno));
+        mgmt_elog("[Rollback::Rollback] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
+        _exit(1);
+    }
+  }
+
   if (varIntFromName("proxy.config.admin.number_config_bak", &numBak) == true) {
     if (numBak > 1) {
       numberBackups = (int) numBak;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.cc Thu Jan 21 03:24:13 2010
@@ -49,7 +49,7 @@
 
 #ifndef _WIN32
 const char *
-  clientCLI::defaultSockPath = PKGLOCALSTATEDIR "/cli";
+  clientCLI::defaultSockPath = DEFAULT_LOCAL_STATE_DIRECTORY "/cli";
 #else
 const int
   clientCLI::defaultCliPort = 9000;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli/clientCLI.h Thu Jan 21 03:24:13 2010
@@ -35,6 +35,11 @@
 #include "ink_platform.h"
 #include "inktomi++.h"
 
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+
 class textBuffer;
 
 /* Client side part of CLI */

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/CliMgmtUtils.h Thu Jan 21 03:24:13 2010
@@ -35,6 +35,11 @@
                                   // on various OSs (linux-4096,osx/bsd-1024,
                                   //                 windows-260,etc)
 
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+
 #define RECORD_GET 0
 #define RECORD_SET 1
 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cli2/cliMain.cc Thu Jan 21 03:24:13 2010
@@ -49,14 +49,14 @@
   CliDisplayPrintf = 1;
 
   // initialize MgmtAPI using TS directory specified in /etc/traffic_server
-  // or PKGLOCALSTATEDIR if /etc/traffic_server does not exist
+  // or DEFAULT_LOCAL_STATE_DIRECTORY if /etc/traffic_server does not exist
 
   if (GetTSDirectory(ts_path)) {
-    status = INKInit(PKGLOCALSTATEDIR);
+    status = INKInit(DEFAULT_LOCAL_STATE_DIRECTORY);
     if (status) {
-      printf("INKInit %d: Failed to initialize MgmtAPI in %s\n", status, PKGLOCALSTATEDIR);
+      printf("INKInit %d: Failed to initialize MgmtAPI in %s\n", status, DEFAULT_LOCAL_STATE_DIRECTORY);
     } else {
-      printf("Successfully Initialized MgmtAPI in %s \n", PKGLOCALSTATEDIR);
+      printf("Successfully Initialized MgmtAPI in %s \n", DEFAULT_LOCAL_STATE_DIRECTORY);
     }
   } else {
     snprintf(config_path, sizeof(config_path), "%s/var/trafficserver/", ts_path);

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/cop/TrafficCop.cc Thu Jan 21 03:24:13 2010
@@ -54,6 +54,11 @@
 #define COP_WARNING  LOG_ERR
 #define COP_DEBUG    LOG_DEBUG
 
+#define DEFAULT_ROOT_DIRECTORY            PREFIX
+#define DEFAULT_LOCAL_STATE_DIRECTORY     "./var/trafficserver"
+#define DEFAULT_SYSTEM_CONFIG_DIRECTORY   "./etc/trafficserver"
+#define DEFAULT_LOG_DIRECTORY             "./var/log/trafficserver"
+
 static char root_dir[PATH_MAX];
 static char local_state_dir[PATH_MAX];
 static char config_dir[PATH_MAX];
@@ -2231,7 +2236,7 @@
     exit(1);
   }
 
-  snprintf(config_dir, sizeof(config_dir), PKGSYSCONFDIR);
+  snprintf(config_dir, sizeof(config_dir), DEFAULT_SYSTEM_CONFIG_DIRECTORY);
   if (stat(config_dir, &info) < 0) {
     // Try 'root_dir/etc/trafficserver' directory
     snprintf(config_dir, sizeof(config_dir), "%s%s%s%s%s",
@@ -2243,7 +2248,7 @@
     }
   }
   
-  snprintf(local_state_dir, sizeof(config_dir), PKGLOCALSTATEDIR);
+  snprintf(local_state_dir, sizeof(config_dir), DEFAULT_LOCAL_STATE_DIRECTORY);
   if (stat(local_state_dir, &info) < 0) {
     // Try 'root_dir/var/trafficserver' directory
     snprintf(local_state_dir, sizeof(local_state_dir), 

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/MgmtAllow.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/MgmtAllow.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/MgmtAllow.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/MgmtAllow.cc Thu Jan 21 03:24:13 2010
@@ -61,6 +61,8 @@
   bool found;
   char *config_file = NULL;
   char *config_dir = NULL;
+  struct stat s;
+  int err;
 
   config_file_var = xstrdup(config_var);
   config_file_path[0] = '\0';
@@ -78,6 +80,15 @@
     return;
   }
 
+  if ((err = stat(config_dir, &s)) < 0) {
+    xfree(config_dir);
+    config_dir = xstrdup(system_config_directory);
+    if ((err = stat(config_dir, &s)) < 0) {
+      mgmt_log(stderr, "%s WARNING: Unable to locate config dir %s.  All IP Addresses will be blocked\n",config_dir);
+      return;
+    }
+  }
+
   if (strlen(config_file) + strlen(config_dir) + 1 > PATH_NAME_MAX) {
     mgmt_log(stderr, "%s WARNING: Illegal config file name %s.  All IP Addresses will be blocked\n", config_file);
   } else {

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebHttp.cc Thu Jan 21 03:24:13 2010
@@ -1881,12 +1881,21 @@
   bool found = false;
   int ret_val;
   struct stat snapDirStat;
-  char config_dir[256];
+  char config_dir[PATH_NAME_MAX];
+  struct stat s;
 
-  if (varStrFromName("proxy.config.config_dir", config_dir, 256) == false)
+  if (varStrFromName("proxy.config.config_dir", config_dir, PATH_NAME_MAX) == false)
     mgmt_fatal(stderr,
                "[WebHttp::handle_submit_snapshot] Unable to find configuration directory from proxy.config.config_dir\n");
 
+  if ((err = stat(config_dir, &s)) < 0) {
+    ink_strncpy(config_dir, system_config_directory,PATH_NAME_MAX); 
+    if ((err = stat(config_dir, &s)) < 0) {
+        mgmt_elog("[WebHttp::handle_submit_snapshot] unable to stat() directory '%s': %d %d, %s\n", 
+                config_dir, err, errno, strerror(errno));
+        mgmt_fatal("[WebHttp::handle_submit_snapshot] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
+    }
+  }
   // check for submit_from_page
   if (ink_hash_table_lookup(whc->post_data_ht, "submit_from_page", (void **) &submit_from_page)) {
     ink_hash_table_delete(whc->post_data_ht, "submit_from_page");

Modified: incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/mgmt2/web2/WebIntrMain.cc Thu Jan 21 03:24:13 2010
@@ -759,6 +759,18 @@
   if (autoconfContext.docRoot == NULL) {
     mgmt_fatal(stderr, "[WebIntrMain] No Client AutoConf Root\n");
   } else {
+    struct stat s;
+    int err;
+    if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
+      xfree(autoconfContext.docRoot);
+      autoconfContext.docRoot = xstrdup(system_config_directory);
+      if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
+        mgmt_elog("[WebIntrMain] unable to stat() directory '%s': %d %d, %s\n", 
+                autoconfContext.docRoot, err, errno, strerror(errno));
+        mgmt_elog("[WebIntrMain] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
+        mgmt_fatal(stderr, "[WebIntrMain] No Client AutoConf Root\n");
+      }
+    }
     autoconfContext.docRootLen = strlen(autoconfContext.docRoot);
   }
   autoconfContext.adminAuthEnabled = 0;

Modified: incubator/trafficserver/traffic/branches/dev/proxy/sac.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/proxy/sac.cc?rev=901514&r1=901513&r2=901514&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/proxy/sac.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/proxy/sac.cc Thu Jan 21 03:24:13 2010
@@ -53,6 +53,9 @@
 extern int CacheClusteringEnabled;
 int auto_clear_cache_flag = 0;
 
+char system_local_state_dir[PATH_NAME_MAX + 1] = DEFAULT_LOCAL_STATE_DIRECTORY;
+char system_log_dir[PATH_NAME_MAX + 1] = DEFAULT_LOG_DIRECTORY;
+
 // ldap required externals ...
 //int  gldap_auth_enable    = 0;
 //int  gsplit_ldap_enabled  = 0;



Mime
View raw message