diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-05-24 10:41:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-24 10:41:30 +0200 |
commit | 05332e243cfcea70f900a741b917d04291a1f9e0 (patch) | |
tree | 880e2d5d1c55fc79b9b402598eafdcf7b27f92b9 /src/journal | |
parent | 44508946534eee032927c263b79464832656dd6e (diff) | |
parent | 4c6d51390c66ccbf647c2943657e8bb693312f38 (diff) | |
download | systemd-05332e243cfcea70f900a741b917d04291a1f9e0.tar.gz systemd-05332e243cfcea70f900a741b917d04291a1f9e0.tar.bz2 systemd-05332e243cfcea70f900a741b917d04291a1f9e0.zip |
Merge pull request #12590 from keszybz/unicode-cmdlines
Use unicode for cmdline printing
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald-context.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/journal/journald-context.c b/src/journal/journald-context.c index e6aeb03b77..46edf24cd6 100644 --- a/src/journal/journald-context.c +++ b/src/journal/journald-context.c @@ -7,6 +7,7 @@ #include "alloc-util.h" #include "audit-util.h" #include "cgroup-util.h" +#include "env-util.h" #include "fd-util.h" #include "fileio.h" #include "fs-util.h" @@ -76,18 +77,14 @@ static size_t cache_max(void) { if (r < 0) { log_warning_errno(r, "Cannot query /proc/meminfo for MemTotal: %m"); cached = CACHE_MAX_FALLBACK; - } else { + } else /* Cache entries are usually a few kB, but the process cmdline is controlled by the * user and can be up to _SC_ARG_MAX, usually 2MB. Let's say that approximately up to * 1/8th of memory may be used by the cache. * * In the common case, this formula gives 64 cache entries for each GB of RAM. */ - long l = sysconf(_SC_ARG_MAX); - assert(l > 0); - - cached = CLAMP(mem_total / 8 / (uint64_t) l, CACHE_MAX_MIN, CACHE_MAX_MAX); - } + cached = CLAMP(mem_total / 8 / sc_arg_max(), CACHE_MAX_MIN, CACHE_MAX_MAX); } return cached; @@ -233,7 +230,7 @@ static void client_context_read_basic(ClientContext *c) { if (get_process_exe(c->pid, &t) >= 0) free_and_replace(c->exe, t); - if (get_process_cmdline(c->pid, 0, false, &t) >= 0) + if (get_process_cmdline(c->pid, SIZE_MAX, 0, &t) >= 0) free_and_replace(c->cmdline, t); if (get_process_capeff(c->pid, &t) >= 0) |