patch #4 (Re: patch #3 (Re: The time has come for a kernel interfacing library layer))

Joerg Sonnenberger joerg at
Thu May 12 09:52:30 PDT 2005

On Thu, May 12, 2005 at 09:23:52AM -0700, Matthew Dillon wrote:
>     No.  The problem is that errno is overloaded onto the return value.
>     You CAN'T TELL whether the return value is an errno or whether it is
>     the return value for the system call without looking at the carry bit.
>     If the carry bit is set, %eax contains errno and there is NO return
>     value (the errno handling code returns -1 to userland).  If the carry
>     bit is not set, %eax/%edx contains the 64 bit return value for the
>     system call.

But we don't return 64bit values. Only 32 bit. Why can't it simply return
errno in one register and the normal return value in the other? It would
save the whole carry register dance.

>     If the system must be translated, there's no point trying to save
>     cycles by overloading the same argument set.  For one thing, the
>     translated system call might require more arguments.  For another,
>     some sort of conversion is already going to have to be done and the
>     cost of copying a couple of 32 bit ints becomes zip relative to the
>     other work that must occur.

OK, so we depricate the generic syscall?

>     The RTLD could set up a dummy TCB (with *NO* TLS storage attached).
>     Poof, problem solved.  That would allow the RTLD to use the same syscall
>     layer that the program uses, too.

The RTLD would have to do that every time it is called, it would have to
reset it before any signal, that's a lot of requirements.
This completely ignores the issues of reentrancy in RTLD, of course.


More information about the Kernel mailing list