Portability enhancements on operating systems that do not provide 'utmpx.h'.

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>