aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/unix
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2017-03-02 11:13:30 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-06 16:17:21 +0000
commitc8c44ebea155f15a9e3067fe05228a1e932185fc (patch)
tree0ef5fd603e4191baadc4376b2840983b2360603b /src/vlib/unix
parent077d6ae7d92623e420925165a7cf77afaa82956b (diff)
Add support for unix { coredump-size <size> }.
Use setrlimit to set the core size limit if the argument is passed to vpp. Change-Id: Ie76c082b2af81337310fcb1925af915a42067f15 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vlib/unix')
-rw-r--r--src/vlib/unix/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index a04d9f9c6ab..6b96cc0db47 100644
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -46,6 +46,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/resource.h>
/** Default CLI pager limit is not configured in startup.conf */
#define UNIX_CLI_DEFAULT_PAGER_LIMIT 100000
@@ -340,6 +342,26 @@ unix_config (vlib_main_t * vm, unformat_input_t * input)
else
if (unformat (input, "cli-history-limit %d", &um->cli_history_limit))
;
+ else if (unformat (input, "coredump-size"))
+ {
+ uword coredump_size = 0;
+ if (unformat (input, "unlimited"))
+ {
+ coredump_size = RLIM_INFINITY;
+ }
+ else
+ if (!unformat (input, "%U", unformat_memory_size, &coredump_size))
+ {
+ return clib_error_return (0,
+ "invalid coredump-size parameter `%U'",
+ format_unformat_error, input);
+ }
+ const struct rlimit new_limit = { coredump_size, coredump_size };
+ if (0 != setrlimit (RLIMIT_CORE, &new_limit))
+ {
+ clib_unix_warning ("prlimit() failed");
+ }
+ }
else if (unformat (input, "full-coredump"))
{
int fd;