diff --git a/testSig.c b/testSig.c new file mode 100644 index 0000000..d3c35fc --- /dev/null +++ b/testSig.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include + +void sigint() +{ + signal(SIGINT, sigint); + printf("sigint received\n"); +} +void main () +{ + int pid; + pid = fork(); +// printf("pid = %d:", pid); + if (!pid) { + printf("child pid = %d(%d)\n", getpid(), pid); + signal(SIGINT, sigint); + while(1); + } else { + printf("parent pid = %d\n", getpid()); + printf("sending SIGINT\n"); + kill(pid, SIGINT); + } +}