Error Codes

System call return codes are in principle to be signed integers. When an error occurs, a negative error code is returned; and if processing is completed normally, E_OK (= 0) or a positive value is returned. The meaning of returned values in the case of normal completion is specified separately for each system call. An exception to this principle is that there are some system calls that do not return when called. A system call that does not return is declared in the C language API as having no return code (that is, a void type function).

The error code is classified into error classes based on the necessity of detection or the occurrence. For error class classification, refer to “5.2 Error Code List”.

[Difference with T-Kernel]

In T-Kernel, the lower 16 bits are set to sub error code and upper 16 bits are set to main error code, but only main error code exists in µT-Kernel. For example, the main error code of E_ID is defined as -18, but in T-Kernel, the upper 16 bits are set to -18 and the lower 16 bits are set to zero. On the other hand, in µT-Kernel, E_ID is defined as -18. To ensure compatibility, you should use macros such as E_ID instead of actual values as error codes.

While macros for processing error codes such as ERCD, MERCD and SERCD exist in T-Kernel, these macros do not exist in µT-Kernel. When porting an application that requires those macros to µT-Kernel, it is necessary to modify the application not to use those macros or to define those macros with the same names as in T-Kernel.

Comments

Click here to Post a Comment