Rename mch_* functions to os_* in os module.
Address clint warnings and other style issues.

* Add const.
* Fix conditions (move && from end to start of line).
* Use int32_t instead of long.
* Use //-style comments.