Correct the API of some functions in the portability headers