This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Simple test case of SIGCHLD hang
- To: gnu-win32 at cygnus dot com, sos at prospect dot com dot ru
- Subject: Simple test case of SIGCHLD hang
- From: Chris Faylor <cgf at bbc dot com>
- Date: Tue, 17 Jun 1997 16:11:08 -0400 (EDT)
I've whittled down zsh's behavior to a simple test case which illustrates
the 'hang' I experience in zsh and, I expect, what others experience in
pdksh.
It apparently has something to do with signal masking. I haven't looked
at the cygwin code in question yet, but I'm sure that it is extremely
difficult, if not impossible to fix. Which means that Sergey should have
a patch available in an hour or so... :-)
Btw, on UNIX the code below prints:
exiting from child
sleeping
in child handler
pid returned = 4901
status returned = 0
On gnuwin32, I get:
exiting from child
sleeping
(hang)
The hang is actually understandable since all signals are blocked, even
SIGINT.
-cgf
#include <stdio.h>
#include <signal.h>
#include <sys/wait.h>
void child(int sig)
{
int pid, status;
fputs("in child handler\n", stderr);
pid = waitpid(-1, &status, WNOHANG|WUNTRACED);
fprintf(stderr, "pid returned = %d\n", pid);
fprintf(stderr, "status returned = %x\n", status);
return;
}
main(int argc, char **argv)
{
sigset_t set, oset;
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, &oset);
setbuf(stderr, NULL);
signal(SIGCHLD, child);
if (fork() == 0) {
fputs("exiting from child\n", stderr);
exit(0);
}
sleep(1);
fputs("sleeping\n", stderr);
sleep(3);
sigdelset(&set, SIGCHLD);
sigsuspend(&set);
exit(0);
}
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".