From owner-freebsd-hackers Tue Sep 26 8:39:56 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from sighup.aventail.com (sighup.aventail.com [64.94.142.130]) by hub.freebsd.org (Postfix) with ESMTP id E6C0D37B422 for ; Tue, 26 Sep 2000 08:39:51 -0700 (PDT) Received: from leo.in.aventail.com (leo.in.aventail.com [192.168.1.136]) by sighup.aventail.com (8.11.0/8.11.0) with ESMTP id e8QFdpj05917 for ; Tue, 26 Sep 2000 08:39:51 -0700 (PDT) Received: by leo.in.aventail.com with Internet Mail Service (5.5.2650.21) id ; Tue, 26 Sep 2000 08:38:18 -0700 Message-ID: From: Jack Tavares To: "'freebsd-hackers@freebsd.org'" Subject: SIGCHLD and sigwait Date: Tue, 26 Sep 2000 08:38:33 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 #include #include #include #include #include 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