Delete some tmp backup files
[eleutheria.git] / ipc / fork.c
blob795bf10923c7281736ff9aa9e1ee4b52ef9543ec
1 /* compile with:
2 gcc fork.c -o fork -Wall -W -Wextra -ansi -pedantic */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <unistd.h>
8 int main(void)
10 pid_t pid;
12 if ((pid = fork()) < 0) { /* fork error */
13 perror("fork");
14 exit(EXIT_FAILURE);
17 else if (pid > 0) /* parent process */
18 printf("Parent's pid: %d\n", getpid());
20 else if (pid == 0) /* child process */
21 printf("Child's pid: %d\n", getpid());
23 return EXIT_SUCCESS;