[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kernelnewbies
Subject:    sigaction system call
From:       Russell Miller <rmiller () duskglow ! com>
Date:       2004-11-15 18:20:39
Message-ID: 200411151220.39743.rmiller () duskglow ! com
[Download RAW message or body]

I'm having a hard time figuring out what the NODEFER flag in sigaction 
actually does.

This is the bit of code that deals with it:

        if (!(ka->sa.sa_flags & SA_NODEFER)) {
                spin_lock_irq(&current->sighand->siglock);
                sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
                sigaddset(&current->blocked,sig);
                recalc_sigpending();
                spin_unlock_irq(&current->sighand->siglock);
        }

it looks like if SA_NODEFER is not set, then it blocks the signal.  Does the 
signal get moved into the pending signal slot, or does it just get blocked?  
I don't understand.

I also don't understand what happens if SA_NODEFER is set.  I have some code 
(that reaps children) that can get triggered at almost the same time.  With 
SA_NODEFER set, it appears that sometimes the handling routine doesn't get 
allowed to finish if it gets interrupted by another signal.

So, an explanation would be appreciated, along with an answer to this 
question:  If I have a SIGCHLD handling routine that is likely to get called 
at the same time, and do NOT set SA_NODEFER, will the SIGCHLD signal get 
deferred until the handling routine gets called, and then processed?  Or will 
the SIGCHLD signal just get lost?  I can't afford to have hundreds of zombies 
sitting around because the "waitpid" call never happens.

--Russell

-- 

Russell Miller - rmiller@duskglow.com - Le Mars, IA
Duskglow Consulting - Helping companies just like you to succeed for ~ 10 yrs.
http://www.duskglow.com - 712-546-5886

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic