Instead of returning negative errno values, return distinct error codes.