summaryrefslogtreecommitdiffstats
path: root/src/vlib/unix/main.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-07-20 19:17:06 +0200
committerDave Wallace <dwallacelf@gmail.com>2017-08-24 19:49:09 +0000
commit57d963f88b2c99e698e2b29f72e190f47f41b1ad (patch)
tree0a26d5fd1e09b4b997db5950fe9bf70835ab9798 /src/vlib/unix/main.c
parentd48e9763bfc39106eca954a28223b72261bf1aeb (diff)
Make VPP runtime directory configurable
New startup config command: unix { runtime-dir /run/vpp } Also, adds recursive mkdir funtion for use in deifferent places like cli-config socket path and dpdk hugepage directory path. Change-Id: I1446ceab9c220c25804e73a743a3ebb383450124 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/unix/main.c')
-rw-r--r--src/vlib/unix/main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index ad1a7c3ccda..cb34a89f87a 100644
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -56,6 +56,8 @@
/** Default CLI history depth if not configured in startup.conf */
#define UNIX_CLI_DEFAULT_HISTORY 50
+char *vlib_default_runtime_dir __attribute__ ((weak));
+char *vlib_default_runtime_dir = "/run/vlib";
unix_main_t unix_main;
@@ -332,6 +334,8 @@ unix_config (vlib_main_t * vm, unformat_input_t * input)
else
if (unformat (input, "cli-listen %s", &um->cli_listen_socket.config))
;
+ else if (unformat (input, "runtime-dir %s", &um->runtime_dir))
+ ;
else if (unformat (input, "cli-line-mode"))
um->cli_line_mode = 1;
else if (unformat (input, "cli-no-banner"))
@@ -432,6 +436,9 @@ unix_config (vlib_main_t * vm, unformat_input_t * input)
}
um->unix_config_complete = 1;
+ if (um->runtime_dir == 0)
+ um->runtime_dir = format (0, "%s%c", vlib_default_runtime_dir, 0);
+
return 0;
}
@@ -463,6 +470,10 @@ unix_config (vlib_main_t * vm, unformat_input_t * input)
* Ask the Linux kernel to dump all memory-mapped address regions, instead
* of just text+data+bss.
*
+ * @cfgcmd{runtime-dir}
+ * Define directory where VPP is going to store all runtime files.
+ * Default is /run/vpp.
+ *
* @cfgcmd{cli-listen, &lt;address:port&gt;}
* Bind the CLI to listen at the address and port given. @clocalhost
* on TCP port @c 5002, given as <tt>cli-listen localhost:5002</tt>,
@@ -489,7 +500,7 @@ unix_config (vlib_main_t * vm, unformat_input_t * input)
* Limit pager buffer to @c nn lines of output.
* A value of @c 0 disables the pager. Default value: @c 100000
?*/
-VLIB_CONFIG_FUNCTION (unix_config, "unix");
+VLIB_EARLY_CONFIG_FUNCTION (unix_config, "unix");
static clib_error_t *
unix_exit (vlib_main_t * vm)