rendered paste body#include <signal.h>
#include <stdio.h>
int examine_signal(int sig)
{
struct sigaction old;
printf(" ** Dumping sigaction information for signal %i\n", sig);
if (sigaction(sig, (void *)0, &old) != 0)
perror("sigaction");
printf("handler : %08p\n", old.sa_handler);
printf("action : %08p\n", old.sa_sigaction);
printf("flags - STOP : %i\n", old.sa_flags & SA_NOCLDSTOP);
printf("flags - WAIT : %i\n", old.sa_flags & SA_NOCLDWAIT);
printf("flags - RESET : %i\n", old.sa_flags & SA_RESETHAND);
printf("flags - STACK : %i\n", old.sa_flags & SA_ONSTACK);
printf("flags - RESTART : %i\n", old.sa_flags & SA_RESTART);
printf("flags - NODEFER : %i\n", old.sa_flags & SA_NODEFER);
printf("flags - SIGINFO : %i\n", old.sa_flags & SA_SIGINFO);
}
void fcn(int p)
{
printf("SIGUSR1\n");
}
int main()
{
struct sigaction act;
examine_signal(SIGUSR1);
signal(SIGUSR1, fcn);
examine_signal(SIGUSR1);
kill(getpid(), SIGUSR1);
examine_signal(SIGUSR1);
kill(getpid(), SIGUSR1);
}