include/list: fix undefined behavior in list_entry() macro

Update list_entry() macro, which is basically the same as the
container_of() macro in the kernel, to use offsetof() to fix undefined
behavior.

Caught using clang -fsanitize=undefined.

[kzak@redhat.com: port from e2fsprogs]

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisk: remove crappy bugs section from man page

Signed-off-by: Karel Zak <kzak@redhat.com>
include/list: add list_last_entry()

Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: use the linked lists from list.h for consoles list

with this the double linked list feature from util-linux is used
instead of the single linked list.

[kzak@redhat.com: use list_last_entry() and list INIT macros]

Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: make usleep() workaround work

Simply fix a compile problem found during debugging console.c

Signed-off-by: Werner Fink <werner@suse.de>
sulogin: use alarm function to indicate if a timeout occurs

A small change to use the alarm handler to indicate if a timeout occurs.

Signed-off-by: Werner Fink <werner@suse.de>
sulogin: mount temporary /dev and /proc if not found

This is very usefull if initrd can not loaded that is no /dev and no
/proc is found.  Also if the /etc/shadow and /etc/passwd is copied into
the initrd the sulogin can be used in initrd even before /dev and/or /proc
are mounted.

Signed-off-by: Werner Fink <werner@suse.de>
sulogin: add multi console feature from SysVinit sulogin

Now after adding Conflicts=rescue.service to getty@.service and
serial-getty@.service and Conflicts=getty.target to rescue.target
all works with `systemctl rescue'.  Even adding init=/sbin/sulogin
to the kernels command line by using the `e' key in grub2 boot
menu works flawless.

This version is without the emergency code as I've this moved to
lib/console.c where it belongs to.

Signed-off-by: Werner Fink <werner@suse.de>
sulogin: minor coding style changes

Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: map NL to CR-NL on output in initial termios settings

(See also 9c62a2326e6e39a5e759830b0b9d91696166fb45 agetty patch).

Signed-off-by: Karel Zak <kzak@redhat.com>
partx: add update command

Update the kernel partition table to match what is on disk.  Remove any
extra partitions and add any missing ones.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
docs: swapon.8 option name fix

The commit 7ae8b469adda598fda28e4ea647d47905b43e172 added option --bytes,
not the initial proposal which was changed after maillist discussion.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
ipcs: assist debugging

One will be able to see enum symbols when debugging, which is not the
case when values are specified as define list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
ipcs: add --human readable size conversion option

Introduces new function ipc_print_size() which will call
size_to_human_string(), and handles the occasional '([k]bytes)' printing
if default size format is requested.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
ipcs: add --bytes size output option

This makes the command being a little closer standard compliant.  See
IEEE Std 1003.1 referral link below for more information.

References: http://pubs.opengroup.org/onlinepubs/009696799/utilities/ipcs.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
isosize: fix usage() -h option print out

Fixes usage() bug from commit 4eba43a7 which claimed sort option for
--help being -H.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
isosize: inform if file does not look like iso file system

$ isosize /dev/urandom
isosize: /dev/urandom: might not be iso file system
-67690643227260

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
more: remove unnecessary variable

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tunelp: deprecation: remove command from default build

It is difficult to think think tunelp command being in use a lot.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
minix: change types in header file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>