svn commit: branches/uClibc-nptl/libc/misc/dirent
Carmelo AMOROSO
carmelo.amoroso at st.com
Thu May 15 07:42:21 UTC 2008
Mike Frysinger wrote:
> On Wednesday 05 December 2007, carmelo at uclibc.org wrote:
>
>> Author: carmelo
>> Date: 2007-12-05 09:25:08 -0800 (Wed, 05 Dec 2007)
>> New Revision: 20626
>>
>> Log:
>> 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.
>>
>
> sorry, but i dont follow. we call __pthread_mutex_init() on the dd_lock
> member of the dirent structure which should initialize the mutex just fine.
> you cant assume that zeroing the structure is the same as initializing the
> mutex. that is why we have these initializer functions in the first place.
> are you suggesting that the __pthread_mutex_init() function is not doing its
> job ?
> -mike
>
Hi Mike,
yes exactly... but only if statically linked. I suspect that in this
case the __pthread_mutex_init is a nop...
likely due to weak aliasing... however, glibc does exactly the same call
to memset
and it uses
#ifndef NOT_IN_libc
__libc_lock_init (dirp->lock);
#endif
instead of __pthread_mutex_init(&(ptr->dd_lock), NULL);
> ------------------------------------------------------------------------
>
> _______________________________________________
> uClibc-cvs mailing list
> uClibc-cvs at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc-cvs
More information about the uClibc
mailing list