Update OS API wrapper

* Add sigprocmask and sigaction
* Miscellaneous fixes and refactoring