When developing a module (device driver, middleware, etc…) that will run in the kernel space, we would like to have some way to capture the reason an operation might fail.
In VxWorks, The errno mechanism seems to be a good way to do this.
Is it possible to define my own errno values?
In the context of VxWorks errno is defined as two 16-bit:
The official vxWorks module values (for errno) are located in the ../h/vwModNum.h file. They are currently using a few hundred numbers. These module numbers all have the form
It is strongly discouraged to modify this (or any) vxWorks header file.
What you could do is create your own module header file and start at a large enough number to not cause conflicts.
The in the individual module header files, create the individual errno values.
In your code, you can then set errno to your defined macro.