Page 2 of 2
Posted: Thu Sep 13, 2007 1:49 am
by JamesM
if you want to report error codes from the kernel, you should use a kernel-specific function.
So I should use another syscall when I don't need one? I don't want to!
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!
As I said before, errno is part of the C library, NOT of the kernel.
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 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
Posted: Thu Sep 13, 2007 2:01 am
by pcmattman
JamesM wrote: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!
I think you are confusing a system call with its relevant userland function call... A userland programmer calls a userland function to do something, then the libc (which you have programmed) calls the needed system calls to get the job done, gets any error codes, and then (if needed) sets errno and returns.
IMHO it really is up to you, it's not my kernel so I can't make decisions on it...
<OT>
Like my avatar?
</OT>
Posted: Thu Sep 13, 2007 2:14 am
by JamesM
pcmattman: I think possibly you took that quote out of context - I was referring to your asm snippet which called a syscall directly. I was merely stating that because I use syscall/sysret, I implicitly don't support that mechanism anyway.
<OT>
Rofl, yes, but what is it?! looks like something from sesame street
</OT>
Posted: Thu Sep 13, 2007 2:36 am
by pcmattman
JamesM wrote:pcmattman: I think possibly you took that quote out of context - I was referring to your asm snippet which called a syscall directly. I was merely stating that because I use syscall/sysret, I implicitly don't support that mechanism anyway.
Ah, okay, I think I know understand where you are coming from.
<OT>
Rofl, yes, but what is it?! looks like something from sesame street
</OT>
It's a
Domokun...
Posted: Thu Sep 13, 2007 2:47 am
by JamesM
Domo lives in an underground cave with Mr. Usaji ... Mr. Usaji is a wise old rabbit who loves to watch TV and drink astringent tea.
Rofl, how did you find him?!
Posted: Thu Sep 13, 2007 4:01 am
by pcmattman
Rofl, how did you find him?!
Through a friend of a friend of mine...