Expose errors through an nn_errno function

Also simplify some of the tests as now no other syscalls are gonna clobber our
errno anymore.
Merge branch 'rafl/error-handling'

* rafl/error-handling:
  Expose errors through an nn_errno function