I’m writing a new syscall inside the linux kernel. I want to implement an error handling system to return to the user who uses the sycall a code which describes the type of the error. I’d like to know how this is done inside the kernel, since I want to follow the standard. I want to let the user read the errno variable, or something equivalent, to understand the error that happened.
Thank you.
P.S. I’m using the latest versione of linux available.
I found that I can simply return the number of the code that I want errno to be set to by returning the code itself in the sycall. All the rest is made by the linux kernel automatically.