So I should use another syscall when I don't need one? I don't want to!if you want to report error codes from the kernel, you should use a kernel-specific function.
pcmattman: You assume that I am using linux's syscall protocol. I'm not! I'm using syscall/sysret. I don't have to provide a system for assembler programs to work. I don't even need to!
And if the programmer didn't link in system libraries then crt0.c wouldn't be linked and as such some syscall initialisation wouldn't happen and some syscalls wouldn't work anyway!
The line is blurred, as far as I'm concerned. POSIX states that after certain function calls (some of which become syscalls) the variable 'errno' is set with the appropriate error code.As I said before, errno is part of the C library, NOT of the kernel.
As far as the kernel is concerned, it gets passed a pointer into which it should place a code describing an error in a syscall. It doesn't know or care if it's a pointer to 'errno', it could be anything. It just so happens that it does point to errno. And, if I should follow your thinking and have a seperate function to retrieve the error code, not only would I have to call 2 syscalls on error, but I would also have to store that error code in the process table/somewhere else in kernel-space. How is duplicating the same data in the name of abstraction helping things?
JamesM