For Linux C programming, I have this handler and main method:
void handler(int number, signinfo_t, void *ignore){ printf("Signaling %d\n", si->si_pid); } int main(){ struct sigaction sig; sig.sa_flags = SA_SIGINFO; sigemptyset(&sig.sa_mask); sig.sa_handler = handler // This line has error If I make the handler with just 1 parameter void handler(int num) it works fine; however, I will not be able to use si->si_pid. The warning I am getting is :
warning: assignment to __sighandler_t from an incompatible pointer type -Wincompatible-pointer-types sig.sa_handler = handler; Do I make it sig.sa_action instead? I want to fix the warning
printf()(and friends) from within a signal handler.handlerfunction definition. Did you mean to writesiginfo_t *si?