[PATCH] fix errno location for non-TLS case

Peter Mazinger ps.m at gmx.net
Thu Dec 1 14:35:18 UTC 2011


hi

> __errno_location() function should not be library-wide hidden in
> non-TLS (thread local storage) case since it should be overriden
> by thread-aware function from linuxthreads.old/linuxthreads.
> If the function is hidden, calls from libc itself always use it
> regardless libpthread linked or not. As the result errno set
> in, for example, recv() function is stored in global errno variable
> instead of thread-specific location.
> 
> Signed-off-by: Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
> ---
>   libc/misc/internals/__errno_location.c |    3 +++
>   libc/sysdeps/linux/common/bits/errno.h |    2 ++
>   2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/libc/misc/internals/__errno_location.c 
> b/libc/misc/internals/__errno_location.c
> index aec7641..371bd26 100644
> --- a/libc/misc/internals/__errno_location.c
> +++ b/libc/misc/internals/__errno_location.c
> @@ -7,6 +7,9 @@
>   #include "internal_errno.h"
>    /* psm: moved to bits/errno.h: */
> +#ifndef __UCLIBC_HAS_TLS__
> +libc_hidden_proto(__errno_location)
> +#endif

libc_hidden_proto does not hide __errno_location, it hides in reality __GI___errno_location

Peter
>   int *
>   #ifndef __UCLIBC_HAS_THREADS__
>   weak_const_function
> diff --git a/libc/sysdeps/linux/common/bits/errno.h 
> b/libc/sysdeps/linux/common/bits/errno.h
> index 0bf6354..5f96c31 100644
> --- a/libc/sysdeps/linux/common/bits/errno.h
> +++ b/libc/sysdeps/linux/common/bits/errno.h
> @@ -43,7 +43,9 @@
>   # ifndef __ASSEMBLER__
>   /* Function to get address of global `errno' variable.  */
>   extern int *__errno_location (void) __THROW __attribute__ ((__const__));
> +#ifdef __UCLIBC_HAS_TLS__
>   libc_hidden_proto(__errno_location)
> +#endif
>    #  ifdef __UCLIBC_HAS_THREADS__
>   /* When using threads, errno is a per-thread value.  */
> -- 
> 1.7.2.5
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de


More information about the uClibc mailing list