diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-17 15:35:01 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:50:17 +0200 |
commit | cbb13afa4ba1ef411a5583626bffa43dd1321a85 (patch) | |
tree | 791206ad263186e67928037b2bfb6d9b14fc5373 | |
parent | f3cd1b1561675c3824734f15889d9309c1e58091 (diff) |
util: rework system_tasks_max() to make use of procfs_tasks_max()
Let's use our new code.
-rw-r--r-- | src/basic/util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index 086ef429a..9c7e6c0ad 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -52,6 +52,7 @@ #include "parse-util.h" //#include "path-util.h" #include "process-util.h" +//#include "procfs-util.h" #include "set.h" #include "signal-util.h" #include "stat-util.h" @@ -480,8 +481,8 @@ uint64_t physical_memory_scale(uint64_t v, uint64_t max) { uint64_t system_tasks_max(void) { #else - _cleanup_free_ char *value = NULL, *root = NULL; uint64_t a = TASKS_MAX, b = TASKS_MAX; + _cleanup_free_ char *root = NULL; /* Determine the maximum number of tasks that may run on this system. We check three sources to determine this * limit: @@ -492,11 +493,10 @@ uint64_t system_tasks_max(void) { * * And then pick the smallest of the three */ - if (read_one_line_file("/proc/sys/kernel/pid_max", &value) >= 0) - (void) safe_atou64(value, &a); + (void) procfs_tasks_get_limit(&a); if (cg_get_root_path(&root) >= 0) { - value = mfree(value); + _cleanup_free_ char *value = NULL; if (cg_get_attribute("pids", root, "pids.max", &value) >= 0) (void) safe_atou64(value, &b); |