1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <stdio.h> void callee (i) int i; { printf("callee: %d\n", i); } main () { int pid; int v = 5; pid = fork (); if (pid == 0) { v++; /* printf ("I'm the child!\n"); */ } else { v--; /* printf ("I'm the proud parent of child #%d!\n", pid); */ } }