In APUE(Advanced programming in the UNIX environment), in second paragraph of section 10.4, mentioned the following
One problem with these early versions was that the action for a signal was reset to its default each time the signal occurred
I write the following code:
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
void sh(int signo) {
printf ("signo=%d\n\n", signo);
}
int main (int argc, char *argv[]) {
signal(SIGUSR1, sh);
while (1)
pause();
return 0;
}
But I see that everytime I send SIGUSR1 (or SIGTERM) signal to the process, signal handler does not changed.
I am using Ubuntu 22.04