Add pid to logged messages

This is handy with multi-process and multithreaded programs.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Add support for clean-up on selected signals

This is by no means complete, but works for most applications. Default
signal handlers for SIGINT, SIGSEGV, SIGABRT and SIGTRAP are replaced
with a simple handler calling exit(1), which triggers library
destructor. Most applications override one or more of them and
explicitly call exit(), so we are okay with them even if our handler is
overridden. Applications which resume application execution after such
signal will work fine too. The only problematic case is when custom
signal handler of the application terminates the process in a way that
does not call library destructors, but I have not seen such yet.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>