#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<signal.h>
void outch(int sig)
{
printf(“outch:i got a signal no.=%d\n”,sig);
sleep(5);
printf(“handler for signal no.=%d has ended\n”,sig);
}
int main()
{
struct sigaction act,act1;
act.sa_handler=outch;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask,SIGQUIT);
sigaction(SIGINT,&act,0);
sigaction(SIGQUIT,&act,0);
act1.sa_handler=outch;
sigemptyset(&act1.sa_mask);
sigaddset(&act1.sa_mask,SIGTSTP);
sigprocmask(SIG_BLOCK,&act1.sa_mask,&act.sa_mask);
while(1)
{
printf(“hello\n”);
sleep(1);
}
return 0;
}
in the above prog. SIG_BLOCK is not doing union of old & new mask.
hi
your program having logical problem ,please follow the documents
i think Kuldeep is right…
u have given wrong argument in sigaction .so u must follow the document
mention that logical problem….