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.