Date: Tue, 26 Sep 2000 08:38:33 -0700 From: Jack Tavares <jtavares@aventail.com> To: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@freebsd.org> Subject: SIGCHLD and sigwait Message-ID: <B56392D22C80D411AF7900508BDC914506F288@maestro.in.aventail.com>
next in thread | raw e-mail | index | archive | help
all -
I am attempting to use sigwait to wait for SIGCHLD from
children of my process
The following does not work (assumint that testchild just
sleeps and then exits)
I never get the signal.
on solaris 2.7 to make this work, i have to call
signal( SIGCHLD, sigHndlr ).
The sigHndlr never gets called cause the sigprocmask
blocks it
What am I doing wrong?
thanks
jack
-- begin testparent.c ----
#include <stdio.h>
#include <unistd.h>
#include <iostream.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
int main( int argc, char ** argv )
{
sigset_t newmask, oldmask;
int signo;
sigemptyset( &newmask );
if( sigaddset( &newmask, SIGCHLD ) )
perror( "sigaddset" );
if( sigprocmask( SIG_BLOCK, &newmask, NULL ) )
perror( "pthread_sigmask() error" );
char * argp[1];
argp[0] = NULL;
pid_t pid = fork( );
if( pid == 0 ) {
if( execv("./testchild", argp ) ) {
perror( "execv" );
}
}
cout << "before sigwait" << endl;
if( sigwait( &newmask, &signo ) )
perror( "sigwait error" );
if( signo == SIGCHLD )
cout << "testparent SIGCHLD" << endl;
}
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B56392D22C80D411AF7900508BDC914506F288>
