Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/types.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <signal.h>
- void funkcja(int sygnal)
- {
- printf("Potomek odebral sygnal nr %d (SIGINT)\n",sygnal);
- }
- int main()
- {
- int pid;
- pid=fork();
- if(pid == -1)
- exit(EXIT_FAILURE);
- if(pid==0)
- {
- signal(SIGINT,funkcja);
- pause();
- return 0;
- }
- else
- {
- sleep(1);
- kill(pid,SIGINT);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement