Adding signal handling.

Unfortunately there's no native Rust way to do this (I'm pretty sure signal handling is not cross platform anyway, but RustRt's signal handler is a noop even for Unix) so we resort to raw libc calls.