#include #include #include #include #include int main () { const int fd = socket (AF_INET, SOCK_STREAM, 0); for (int index = 0; index != 64; index++) { dup (fd); const pid_t pid = fork (); switch (pid) { case -1: // error perror ("\tfork"); exit (EXIT_FAILURE); case 0: // child printf ("\tfork [pid = %d]\n", getpid ()); return EXIT_SUCCESS; break; default: // parent { int status; if (wait (&status) == -1) { perror ("\twait ()"); exit (EXIT_FAILURE); } } } } }