Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, char const *argv[])
- {
- pid_t pid, pid1;
- int stato;
- pid = fork();
- if(pid == 0)
- {
- pid_t a;
- a = fork();
- if(a == 0)
- {
- while(1)
- {
- }
- }
- }
- else
- {
- pid1 = wait(&stato);
- if(WIFEXITED(stato))
- printf("Exit status: %d\n", WEXITSTATUS(stato));
- else if(WIFSIGNALED(stato))
- printf("ANOMALO: %d\n", WTERMSIG(stato) );
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement