For all functions, return values are used as error codes.
Return value 0 means normal termination, a value other than 0 means error or warning. Error content is defined depending on the return value.