#include #include #include #include int main() { pid_t pid; int status; pid = fork(); if (pid < 0) { fprintf(stderr, "Błąd forka\n"); exit(1); } else if (pid == 0) { printf("Jestem procesem potomnym\n"); exit(2); } else { printf("Jestem procesem macierzystym. Oczekuję na zakończenie procesu potomnego...\n"); wait(&status); printf("Proces potomny zakończony. Kod powrotu: %d\n", status); } return 0; }