[uClibc] problem with pthread_manager

Thomas Eschenbacher Thomas.Eschenbacher at gmx.de
Thu Jun 24 18:26:34 UTC 2004


Hi,

I found out that the following code sequence in 
libpthread/linuxthreads/manager.c is responsible for the malfuction of 
our application:

-------------------------------------------------
   /* Check for termination of the main thread */
   if (getppid() == 1) {
     pthread_kill_all_threads(SIGKILL, 0);
     _exit(0);
   }
-------------------------------------------------

Can someone explain me how in the world this chould ever have
worked????

As I interprete it, it means: "as soon as something happens and if we
are started from the init() context, then exit". And this is what
happens: our program is running instead of init - and therefore fails!

IMO this code is nonsense. What if the process is started from a shell, 
which has a pid >= 2? The pids would start at 3 and then this check
would never become active!?

I attached a patch that should fix that, or at least should do what the
comment above that sequence suggests. It assumes that the parent of the
thread manager always is the main thread. Is this so?

Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: manager.c.diff.gz
Type: application/x-gzip
Size: 481 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20040624/10f69900/attachment.bin 


More information about the uClibc mailing list