dmesg: move get_boot_time() to lib/timeutils

In future the last(1) will use get_boot_time() as well.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: fix is_phantom() detection

The /proc/<pid>/loginuid is not always available, and when so a running
session should not be determined to be gone.  This is a regression from
commit mentioned in reference.

Sessions that have started before previous system boot, and did not log
out meanwhile, will be marked as gone.  It is fair to say that these
sessions are most likely result of a wtmp corruption.

Reference: 404fa3f93c00c7e130f5a0ec963b2dc6a3743986
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
include/c.h: add macro to print definitions as string

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
mkswap, swaplabel: move version number to header

Corrently only the swap version 1 is supported, which is a magic value so
move it to header.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
mkswap: remove legacy swap structure

If software archeolgists want to know how the old, and unused, swap
header looked they can dig it from the revision history.

[kzak@redhat.com: - use sizeof() for SWAP_HEADER_SIZE]

Reference: 4c85aa3a4c26f2a2c33bf16960b548d5bbd5b4bf
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/swapheader.h: ensure type sizes

Use consistently the same type sizes as in libblkid and kernel.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
swapon: swaps with legacy version label are not supported

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
swapon, swapheader, mkswap: move swap signature to header

Both swapon and mkswap need to know what is valid device signature, so
share the value.

[kzak@redhat.com: - use SWAP_SIGNATURE_SZ properly in write_signature()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/timeutils: fix memory leak

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lib/pager: use names when referring to standard file descriptors

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
libsmartcols: check recount_widths() return value

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
dmesg: add missing include

Signed-off-by: Karel Zak <kzak@redhat.com>
lsblk: add -O option to show all available columns

Simple command line for gathering information as many as possible is
useful when understanding a system, especially when trouble shooting.

This patch introduces -O option which enables all available columns.

[kzak@redhat.com: - define collisions between options,
                  - define columns when parse argv[]]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>