[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#258740: sigwait and -lpthread.



At Sun, 11 Jul 2004 15:12:14 +0530,
Aneesh Kumar K.V <aneesh.kumar@hp.com> wrote:
> When i link the below program with -lpthread I can't kill the 
> application with SIGTERM. I found that /proc/<pid>/status  list some 
> different SigBlk
> 
> #include <stdio.h>
> #include <signal.h>
> #include <sys/wait.h>
> 
> main()
> {
>         sigset_t set;
>         int sig;
>         sigemptyset(&set);
> 
>         sigaddset(&set,SIGCHLD);
>         sigwait(&set, &sig);
>         if(sig == SIGCHLD ){
> 
>                 /*
>                  * Removing the zombie(s)
>                  */
>                 while(wait3(NULL,WNOHANG,NULL) > 0) ;
>         } else {
> 
>                 printf("Received a signal on which i was not doing a 
> sigwait \n");
>                 exit(1);
> 
>         }
> }

On 2.4:

gotom@bechstein)~/258740$ ./test &
[1] 6373
gotom@bechstein)~/258740$ kill -TERM 6373  
gotom@bechstein)~/258740$ 
[1]+  Terminated              ./test

On 2.6 installed nptl:

gotom@moog:~/debian/glibc/bugs/258740$ ./test &
[1] 17972
gotom@moog:~/debian/glibc/bugs/258740$ kill -TERM 17972
[1]+  Terminated              ./test
gotom@moog:~/debian/glibc/bugs/258740$ LD_ASSUME_KERNEL=2.4.1 ./test &
[1] 17973
gotom@moog:~/debian/glibc/bugs/258740$ kill -TERM 17973
gotom@moog:~/debian/glibc/bugs/258740$ 
[1]+  Terminated              LD_ASSUME_KERNEL=2.4.1 ./test

> I am running this on a 2.4 kernel. With 2.6 it seems to work fine. ( I 
> found that 2.6 strace reports rt_sigtimedwait where as strace with 2.4 
> reports rt_sigsuspend )

Note that rt_sigtimedwait was already implemented in 2.2.

BTW, you need to write the exact kernel version, you architecture and
the existence of libc6-i686.

Regards,
-- gotom



Reply to: