[systemd-devel] systemctl show outputs incorrect MemoryCurrent value
Lennart Poettering
lennart at poettering.net
Thu Jul 26 14:30:47 UTC 2018
On Do, 26.07.18 08:07, Reindl Harald (h.reindl at thelounge.net) wrote:
> arbitary numbers also don't help machines much and UINT64_MAX is a
> random value making no sense - really - something like -1 but why in teh
> world UINT64_MAX for something unset
-1 and UINT64_MAX are kinda the same thing if you are talking about
64bit integers (which we usually do). It's mostly a matter of
presentation.
Using -1 or UINT64_MAX as marker for "not set" or "invalid" or similar
concepts is pretty widely done across Linux APIs. For example,
RLIM_INFINITY (the value used for unbounded resource limits) or
MAP_FAILED (the error returned by mmap() on failure) are exactly
that. cgroups exposes unbounded/unset attributes like this too.
Hence, it's not a "random" value. It's common practice.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list