patch #1 to add pointer to errno in TCB (Re: The time has come for a kernel interfacing library layer)

David Xu davidxu at freebsd.org
Mon May 9 21:51:52 PDT 2005


4890 at xxxxxxxxxxxxxxxxx> <200505100139.j4A1dnsW020010 at xxxxxxxxxxxxxxxxxxxx>
In-Reply-To: <200505100139.j4A1dnsW020010 at xxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 31
Message-ID: <42803da2$0$718$415eb37d at xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
NNTP-Posting-Host: 221.12.27.25
X-Trace: 1115700643 crater_reader.dragonflybsd.org 718 221.12.27.25
Xref: crater_reader.dragonflybsd.org dragonfly.kernel:8395

Matthew Dillon wrote:
>     Ok.  Here's the first patch. 
> 
>     * Call to _init_tls() from the CRT startup code is now mandatory for
>       both static and dynamic binaries.
> 
>     * Pointer to errno now embedded in the TCB.  The errno is still a
>       __thread (or whatever)... that hasn't changed.
> 
>     * TLS allocation code is now passed additional parameters so it can
>       properly set the errno pointer.
> 
>     * cerror() now sets the errno by indirecting through the errno pointer
>       in the TCB.
> 
>     * I did a quick test for a standard link, static link, pthreads link,
>       and -lthread_xu link to make sure the errno pointer matches &errno.
> 
>     This will also allow the syscall layer code to set errno without having
>     to be dynamically linked or relocated.
> 
>     Please test!
> 
> 						-Matt
> 
I am confused that rtld-elf does not need threaded errno whether you
implement it as old libc( use a function ) or not,  rtld-elf
definitively will run under threaded process, its code will be
executed by multiple threads at same time!

David Xu





More information about the Kernel mailing list