Revision 20625, opendir

Carmelo Amoroso carmelo73 at gmail.com
Mon Jun 9 08:44:49 UTC 2008


2008/6/7 Bernd Schmidt <bernds_cb1 at t-online.de>:
> I'm reviewing old patches before checking them into the Blackfin
> repository...
>
>   r20625 | carmelo | 2007-12-05
>
>   Fix opendir problem when statically linked due to a missing
>   initialization of the mutex field within DIR struct.
>   When linked dynamically instead, __pthread_mutex_init will
>   initialize the mutex itself. Without this fix, any call to
>   readdir will stuck forever trying to acquire the mutex.
>
> This makes no sense to me, and we'd probably have noticed if readdir
> wasn't working.  In a static link that does not include libpthread, all
> the pthread_ functions are supposed to resolve to a weak function called
> ___pthread_return_0, and this is what happens over here:
>
> bernds at beaker $ bfin-uclinux-nm a.out.gdb|grep pthread
> 00000710 W __pthread_cleanup_pop_restore
> 00000710 W __pthread_cleanup_push_defer
>          w ___pthread_initialize_minimal
> 00000700 W ___pthread_mutex_init
> 00000700 W ___pthread_mutex_lock
> 00000700 W ___pthread_mutex_trylock
> 00000700 W ___pthread_mutex_unlock
> 00000700 t ___pthread_return_0
> 00000710 t ___pthread_return_void
>
> When libpthread is included in the link, __pthread_mutex_init will do
> the initialization.  So, what's going on?
>
>
> Bernd
Hi Bernd,
likely you're right ... but this is not true for the nptl branch.
I've almost completed to port a lot of changes from th trunk to the nptl branch
(one of this changes are exactly on weaks pthread symbols) and I'll
check again if this
fix is still required (anyway, glibc has the memset as I added into the uclibc),
but your point is correct.
Please, let me complete this work and I'll remove the change is not
longer useful.
Mike few weeks ago pointed out your same question.

If you don't like it, do not include into your blackfin tree.

Cheers,
Carmelo
> --
> This footer brought to you by insane German lawmakers.
> Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
> Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
> Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc
>



More information about the uClibc mailing list