Is using waitpid() reset SIGCHLD?

Is using waitpid() reset SIGCHLD?

Post by Jean-Marc Piu » Wed, 23 Jul 1997 04:00:00



Is it required to reinitialise SIGCHLD (to the application specific handler) after
using of 'waitpid()' system call?  (system 5!)

So, I mean using this system call outside of the SIGCHLD signal handler!

Whatever it is not a problem to reinitialise the signal many times, that BOTHER me
to do so, if it is not absolutely required!...

Thanks!  =-)

jmpiuze...

 
 
 

Is using waitpid() reset SIGCHLD?

Post by Colin For » Sat, 26 Jul 1997 04:00:00



> Is it required to reinitialise SIGCHLD (to the application specific handler) after
> using of 'waitpid()' system call?  (system 5!)

> So, I mean using this system call outside of the SIGCHLD signal handler!

> Whatever it is not a problem to reinitialise the signal many times, that BOTHER me
> to do so, if it is not absolutely required!...

> Thanks!  =-)

> jmpiuze...

I think the answer to this is "YES" you do have to
re-install the signal handler after each caught signal.
Why don't you do it in the signal handler function ?

Col.
--
Address  - NORTEL Brixham Road Paignton Devon England TQ4 7BE
Position - Software Specialist

Phone    - +44-803-667508 [Voice Mail]

 
 
 

Is using waitpid() reset SIGCHLD?

Post by Andrew Giert » Sat, 26 Jul 1997 04:00:00


 Colin> I think the answer to this is "YES" you do have to
 Colin> re-install the signal handler after each caught signal.

Not if you use sigaction.

You should *always* use sigaction to catch signals.

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>

 
 
 

1. Will the waitpid() in parent process return if I don't catch the SIGCHLD signal?

If I use a SIGALRM signal to stop a child process, will the waitpid()
function in parent process return if I don't catch the SIGCHLD?

if ((pid=fork()<0)
    errmessage;
else if (pid == 0)     //child process
{
    signal(SIGALRM, handle_alarm);
    alarm(20);         //Start the timer
    ftp_cmd();         //A ftp system command
    alarm(0);          //Close the timer
    return;
else
{
    waitpid(pid...)    //Block mode

Thank you for any suggestion and attention! :-)

Jerry

2. making file in a shell script via cat command.

3. waitpid() does not set errno = EINTR when SIGCHLD is handled

4. linux gpm -mouse

5. concurrent SIGCHLD or child _exit, waitpid

6. Installation of JDKEE on Redhat 7.2

7. UNP Book Question - waitpid in SIGCHLD signal handler

8. ipchains to iptables conversion

9. wait(2) and waitpid(2) in a SIGCHLD handler

10. waitpid and SIGCHLD

11. using waitpid with LinuxThreads

12. Problem using waitpid.

13. SIGCHLD doesn't work right in Linux (using Expect to test)