public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10638] New: system(3) does not catch its own SIGCHLD
@ 2009-09-14 13:10 phdm at macqel dot be
  2009-09-15 11:36 ` [Bug libc/10638] " phdm at macqel dot be
  2009-09-18 13:54 ` pasky at suse dot cz
  0 siblings, 2 replies; 3+ messages in thread
From: phdm at macqel dot be @ 2009-09-14 13:10 UTC (permalink / raw)
  To: glibc-bugs

I have a program catching SIGCHLD itself, in order to e.g. restart failed
children processes.  This program also calls system(3) for children run once.
When system should return, I get a SIGCHLD instead, and my process gets blocked
endlessly in the wait call in my SIGCHLD handler, because the particular child
run by system does not exist anymore and has already been wait()ed for, I
assume, and my process has other children running.

This was not so on AIX and unix sysv systems, and the manpage of system says
nothing about such a behaviour

Here is a testcase :

#include <signal.h>
#include <stdio.h>

void sigcld(int signo)
        {
        int stat;

        printf("sigcld\n");
        wait(&stat);
        }

main(int argc, char **argv)
        {
        int child;

        if ((child = fork()) == 0)
                pause();
        if (!argv[1])
                signal(SIGCHLD, sigcld);
        system("date");
        kill(child, SIGTERM);
        }

If you run it as:
         ./a.out nosignalhandler
a.out terminates and kills the forked child
If you run it as:
         ./a.out
a.out gets blocked in the wait() call in the SIGCHLD handler

-- 
           Summary: system(3) does not catch its own SIGCHLD
           Product: glibc
           Version: 2.9
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: phdm at macqel dot be
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10638

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/10638] system(3) does not catch its own SIGCHLD
  2009-09-14 13:10 [Bug libc/10638] New: system(3) does not catch its own SIGCHLD phdm at macqel dot be
@ 2009-09-15 11:36 ` phdm at macqel dot be
  2009-09-18 13:54 ` pasky at suse dot cz
  1 sibling, 0 replies; 3+ messages in thread
From: phdm at macqel dot be @ 2009-09-15 11:36 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From phdm at macqel dot be  2009-09-15 11:35 -------
Sorry for wrong analysis.  On sysv and AIX, one also get a SIGCHLD at the end of
system(3), but on sysv the wait call in the sigcld handler returns, so that the
program does not block.  On AIX, the small example behaves as on linux, but my
real application does not block, while my application blocks on linux.  I don't
know at the moment what makes the difference between AIX and linux behaviours in
my application.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10638

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/10638] system(3) does not catch its own SIGCHLD
  2009-09-14 13:10 [Bug libc/10638] New: system(3) does not catch its own SIGCHLD phdm at macqel dot be
  2009-09-15 11:36 ` [Bug libc/10638] " phdm at macqel dot be
@ 2009-09-18 13:54 ` pasky at suse dot cz
  1 sibling, 0 replies; 3+ messages in thread
From: pasky at suse dot cz @ 2009-09-18 13:54 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From pasky at suse dot cz  2009-09-18 13:53 -------
Ok, in that case please reopen when you find the reason if you think it really
is glibc bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=10638

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-18 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-14 13:10 [Bug libc/10638] New: system(3) does not catch its own SIGCHLD phdm at macqel dot be
2009-09-15 11:36 ` [Bug libc/10638] " phdm at macqel dot be
2009-09-18 13:54 ` pasky at suse dot cz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).