[nptl] more stdout issues

Natanael Copa natanael.copa at gmail.com
Tue Apr 13 06:17:46 UTC 2010


2010/4/13 Timo Teräs <timo.teras at iki.fi>:
>
> It looks like no one bothered to implement the uClibc needed stdio
> locking initialization. It seems that only linuxthreads.old does this.
> So both linuxthreads.new and nptl seem to be broken wrt. stdio locking.

ah. yes.

> I did not even try compile testing the below, but something like
> this should help. Could you test this?
>
> nptl: initialize stdio locking
>
> uClibc requires the threading library to enable locking for
> stdio, or the locking is not done at all.
>
> Signed-off-by: Timo Teräs <timo.teras at iki.fi>
>
> diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
> index b651a3e..16f62f6 100644
> --- a/libpthread/nptl/init.c
> +++ b/libpthread/nptl/init.c
> @@ -35,6 +35,7 @@
> #include <lowlevellock.h>
> #include <bits/kernel-features.h>
>
> +#include <uClibc_stdio.h>

this didnt even compile. I changed it to <bits/uClibc_stdio.h> which
also failed. Finally, <stdio.h> worked.

>
> /* Size and alignment of static TLS block.  */
> size_t __static_tls_size;
> @@ -423,6 +424,17 @@ __pthread_initialize_minimal_internal (void)
>
>  /* Determine whether the machine is SMP or not.  */
>  __is_smp = is_smp_system ();
> +
> +  /* uClibc-specific stdio initialization for threads. */
> +  {
> +    FILE *fp;
> +    _stdio_user_locking = 0;       /* 2 if threading not initialized */
> +    for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) {
> +      if (fp->__user_locking != 1) {
> +        fp->__user_locking = 0;
> +      }
> +    }
> +  }
> }
> strong_alias (__pthread_initialize_minimal_internal,
>              __pthread_initialize_minimal)
>

With that patch, the phello test program works. Please apply (with
<stdio.h> as mentioned above)

Thanks!

-- 
Natanael Copa


More information about the uClibc mailing list