Bug with pthreads

Peter Pointner pr at schenk.isar.de
Wed Feb 23 11:11:43 UTC 2000


Ok, now i reply to my own mail with a fix. The patch at the end of this
message changes the POSIX thread name thing so that it looks like that in
the ITRON api. Seem to work.

Peter

On Tue, 22 Feb 2000, Peter Pointner wrote:

> Hello,
> 
> I think there is a bug somewhere in the posix api:
> 
> a) exec/posix/src/pthread.c, _POSIX_Threads_Manager_initialization() calls
>    _Objects_Initialize_information with parameter 'is_string' set to TRUE.
> 
> b) exec/posix/src/pthreadcreate.c, pthread_create() defines
>       char * default_name = "psx";
>    on the stack, then calls
>       _Thread_Initialize( ..., &default_name);
> 
> c) exec/score/src/threadinitialize.c, _Thread_Initialize() gives this
>    parameter to the macro _Objects_Open
> 
> d) exec/score/macros/rtems/score/object.inl, _Objects_Open() decides
>    (based on the information from a) ), to pass this parameter to 
>    _Objects_Copy_name_string
> 
> e) exec/score/src/objectcopynamestring.c, _Objects_Copy_name_string treats
>    the value as pointer to a null terminated string and copies it.
> 
> If I didn't get something wrong, this might lead to unpredictable results,
> if this '&default_name' doesn't contain a null byte.
> 
> I'm a bit too confused now to fix that. Any takers?
> 
> Peter
> 

Index: pthread.c
===================================================================
RCS file: /m/e2k/rtems-4.5/rtems/c/src/exec/posix/src/pthread.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pthread.c
--- pthread.c	2000/02/09 13:23:13	1.1.1.1
+++ pthread.c	2000/02/23 10:27:50
@@ -356,8 +356,8 @@
     FALSE,                               /* does not support global */
     maximum_pthreads,
     sizeof( Thread_Control ),
-    TRUE,
-    5,                                   /* length is arbitrary for now */
+    FALSE,
+    0,                                   /* posix threads don't have a name */
     TRUE                                 /* this class is threads */
   );
 




More information about the users mailing list