From: Thomas Blume Date: Mon, 15 Nov 2021 09:11:44 +0000 (+0100) Subject: systemd-coredump: allow setting external core size to infinity X-Git-Tag: v250-rc1~209 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e8791a04225d85720d045dcc87c076fec5eee7f;p=thirdparty%2Fsystemd.git systemd-coredump: allow setting external core size to infinity Make it compatible to the ulimit setting: unlimited --- diff --git a/man/coredump.conf.xml b/man/coredump.conf.xml index 1751191ec0c..6392270543d 100644 --- a/man/coredump.conf.xml +++ b/man/coredump.conf.xml @@ -98,6 +98,8 @@ The maximum (compressed or uncompressed) size in bytes of a core to be saved. Unit suffixes are allowed just as in . + + ExternalSizeMax=infinity sets the core size to unlimited. diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 86d087729a3..9b035a5d8ad 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -154,13 +154,13 @@ static uint64_t arg_max_use = UINT64_MAX; static int parse_config(void) { static const ConfigTableItem items[] = { - { "Coredump", "Storage", config_parse_coredump_storage, 0, &arg_storage }, - { "Coredump", "Compress", config_parse_bool, 0, &arg_compress }, - { "Coredump", "ProcessSizeMax", config_parse_iec_uint64, 0, &arg_process_size_max }, - { "Coredump", "ExternalSizeMax", config_parse_iec_uint64, 0, &arg_external_size_max }, - { "Coredump", "JournalSizeMax", config_parse_iec_size, 0, &arg_journal_size_max }, - { "Coredump", "KeepFree", config_parse_iec_uint64, 0, &arg_keep_free }, - { "Coredump", "MaxUse", config_parse_iec_uint64, 0, &arg_max_use }, + { "Coredump", "Storage", config_parse_coredump_storage, 0, &arg_storage }, + { "Coredump", "Compress", config_parse_bool, 0, &arg_compress }, + { "Coredump", "ProcessSizeMax", config_parse_iec_uint64, 0, &arg_process_size_max }, + { "Coredump", "ExternalSizeMax", config_parse_iec_uint64_infinity, 0, &arg_external_size_max }, + { "Coredump", "JournalSizeMax", config_parse_iec_size, 0, &arg_journal_size_max }, + { "Coredump", "KeepFree", config_parse_iec_uint64, 0, &arg_keep_free }, + { "Coredump", "MaxUse", config_parse_iec_uint64, 0, &arg_max_use }, {} }; diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 7eda2da1c0e..1e1967d7ea2 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -677,6 +677,31 @@ int config_parse_iec_uint64( return 0; } +int config_parse_iec_uint64_infinity( + const char* unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + uint64_t *bytes = data; + + assert(rvalue); + assert(data); + + if (streq(rvalue, "infinity")) { + *bytes = UINT64_MAX; + return 0; + } + + return config_parse_iec_uint64(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata); +} + int config_parse_bool( const char* unit, const char *filename, diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index 63b749d42a2..d6866655327 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -126,6 +126,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_double); CONFIG_PARSER_PROTOTYPE(config_parse_iec_size); CONFIG_PARSER_PROTOTYPE(config_parse_si_uint64); CONFIG_PARSER_PROTOTYPE(config_parse_iec_uint64); +CONFIG_PARSER_PROTOTYPE(config_parse_iec_uint64_infinity); CONFIG_PARSER_PROTOTYPE(config_parse_bool); CONFIG_PARSER_PROTOTYPE(config_parse_id128); CONFIG_PARSER_PROTOTYPE(config_parse_tristate);