in_mem: consider mem_unit when computing memory/swap sizes. (#730)
in_mem: consider mem_unit when computing memory/swap sizes. (#730)

In particular, the current code naively assumes that a sysinfo() call
returns memory/swap sizes in bytes. The problem is, however, it's not
always the case. According to sysinfo(2):

    In the above structure, sizes of the memory and swap fields are
    given as multiples of mem_unit bytes.

This patch fixes the issue by introducing a function calc_kb() that
computes sizes based on mem_unit.

Signed-off-by: Fujimoto Seiji <ef879192bb1e41d519c82cf76440dc8e9a530806@clear-code.com>
nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit