3.2.6 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 se parately 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).
An error code consists of the main error code and sub error code. The low 16 bits of the error code are the sub error code, and the remaining high bits are the main error code. Main error codes are classified into error classes based on the necessity of their detection, the circumstances in which they occur and other factors. Since T-Kernel/OS does not use a sub error code, these bits are always 0.
#define MERCD(er) ((ER)(er)>>16) /* Main error code */
#define SERCD(er) ((H)(er)) /* Sub error code */
#define ERCD(mer, ser) ((ER)(mer)<<16|(ER)(UH)(ser))

Comments