Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- int main(void)
- {
- int foo;
- printf("pid \t %d \n", getpid());
- printf("ppid \t %d \n", geppid());
- foo = fork();
- printf("foo = %d \n", foo);
- if(foo > 0) {
- printf("Jestem procesem maciezystym! ID = %d \n", getpid());
- }
- else {
- printf("Jestem potomkiem! ID = %d \n", getpid());
- }
- if(foo == -1) {
- printf("Blad! \n");
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement