Help understanding signals

I am having trouble with folowing

sigset_t s;    // now s represents set of signals
sigemptyset(&s) ; // initialize this set and exclude all the signals from it.is it empty?
sigaddset(&s,SIGILL);//this set containts only SIGILL signal
sigprocmask(SIG_BLOCK,&s,NULL);//lost on this one

Can anyone see my comment in the code and tell me if I am right. Last sigprocmask i read in documentation but I didnt really understand it.
Any help would be great

Try reading 'man sigprocmask'. SIG_BLOCK is the operation being performed, and SIGILL is the signal in question. So the code is

  • Creating an empty set of signals
  • Adding SIGILL to that set
  • Blocking every signal in the set, i.e. adding SIGILL to the set of blocked signals

In your third step you said "Blocking every signal in the set, i.e. adding SIGILL to the set of blocked signals".
Didn't we add SIGILL in previous step?If the set is empty then we only blocking SIGILL?
When we have empty set of signals does that mean there isn't any signals in it?

You added it to the s variable, is all. The system hasn't been told to use it, that's what sigprocmask is for.

No. From man sigprocmask:

       SIG_BLOCK
              The set of blocked signals is the union of the current  set  and
              the set argument.

...meaning. you're adding SIGILL to whatever signals are currently being blocked.

Yes. an empty set has nothing in it.