Implement readn() as an analogue to writen(), and normalize the API to return the number of bytes written/read, or -1 on error.

Issue: PLCR-521