[uClibc 0000972]: errno broken in linuxthreads.old

bugs at busybox.net bugs at busybox.net
Thu Jul 27 12:36:15 UTC 2006


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=972 
====================================================================== 
Reported By:                bsfost
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   972
Category:                   Posix Threads
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             07-27-2006 05:36 PDT
Last Modified:              07-27-2006 05:36 PDT
====================================================================== 
Summary:                    errno broken in linuxthreads.old
Description: 
I have a problem where, effectively, errno is never set in threads within
applications built with uClibc (using the linuxthreads.old library).
Debugging has shown that the system call (send(), in the case of the
example) is made and the global/libc errno is set prior to returning to
application code. The subsequent request to retrieve the error code calls
into __errno_location() in the linuxthreads.old library, which finds the
appropriate thread descriptor and returns (*self->p_errnop), which was
never set.

I didn't see anything obvious that "intended" to set the thread specific
errno value based on system calls made on that thread's behalf (i.e., I
would expect this in the syscall wrappers, perhaps..?), but I'm fairly new
to this library so I'm not sure whether this is considered a bug,
misconfiguration or simple lack of functionality. 

For completeness, I compared the behavior with an _old_ glibc-2.2 system
which looked like it had the same general design. The application worked
in this case, but I noticed that the thread_self() call (while requesting
the errno value in the thread, following the failed syscall) ended up
returning a pointer to the __pthread_initial_thread structure rather than
the specific thread structure I assume it created when it cloned (which is
what happens in uClibc's thread_self()). 

I also tested a quick change in uClibc by setting
__pthread_manager_thread's p_errnop to '&_errno' as well as new threads
created in pthread_handle_create(). This change allowed expected behavior,
but it's probably not the appropriate fix. Any information on this is
greatly appreciated, and let me know if I've been unclear or missed any
important points. Thanks.

Brian

====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-27-06 05:36  bsfost         New Issue                                    
07-27-06 05:36  bsfost         Status                   new => assigned     
07-27-06 05:36  bsfost         Assigned To               => uClibc          
======================================================================




More information about the uClibc-cvs mailing list