errno support

cc @CindyLinz