aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-03-02 12:33:48 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-03-08 23:23:40 +0000
commite5ef1d7a7b63fcbd43529f079137c0c990a8de2f (patch)
tree0bd52b02e7e2e16eeb5c85196e75bf7e1047d3ee /src
parent871349371a62f1f20b159b6afead8e84f8a2322b (diff)
vlib: add process restart cli
Change-Id: I8b81e53ebea573b4edb17aca7e1c284f3984e399 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vlib/cli.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vlib/cli.c b/src/vlib/cli.c
index 2d141115..f853f655 100644
--- a/src/vlib/cli.c
+++ b/src/vlib/cli.c
@@ -39,6 +39,7 @@
#include <vlib/vlib.h>
#include <vppinfra/cpu.h>
+#include <unistd.h>
/* Root of all show commands. */
/* *INDENT-OFF* */
@@ -757,6 +758,25 @@ VLIB_CLI_COMMAND (cmd_test_heap_validate,static) = {
};
/* *INDENT-ON* */
+static clib_error_t *
+restart_cmd_fn (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ char *newenviron[] = { NULL };
+
+ execve (vm->name, (char **) vm->argv, newenviron);
+
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (restart_cmd,static) = {
+ .path = "restart",
+ .short_help = "restart process",
+ .function = restart_cmd_fn,
+};
+/* *INDENT-ON* */
+
#ifdef TEST_CODE
/*
* A trivial test harness to verify the per-process output_function