POSIX.1 and SIGCHLD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Techies,

I have a query regarding a behavior of SIGCHLD in
POSIX.1 compliant systems.

As per older handling of SIGCHLD, if we set the
disposition of SIGHCHLD to be caught, the kernel
immediately checks if there are aby child processes
ready to be waited for and , if so, calls SIGCHLD
behavior.

Following code snipped should give out of stack space
and should terminate.
// Signal Handler for SIGCHLD
static void sig_chld()
{
    int status;
    pid_t pid;
    signal(SIGCHLD,sig_chld);
     
    pid = wait(&status);
    return;
}

I fully agree that POSIX signals are reliable and
hence we need not set signal handler again in signal
handler. But what should happen if I do it explicitly?
I was expecting to have a recursive call to signal
handler and hence out of stack should have occured.

But the aboVe code works fine on Linux Kernel 2.4.20.
How does POSIX handles if we establish a signal
handler and there exists a terminated child which
needs to be waited for.

Please advise on this.

Regards
Dinesh



		
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux