Are we sure this is safe i.e. this only calls async-signal-safe functions:
http://man7.org/linux/man-pages/man7/signal.7.html