sexta-feira, 18 de dezembro de 2009

Make a Zombie

/*
* file: make-zombie.c
* compiling: gcc -o make-zombie make-zombie.c
* This will make a Zombie Process that will endure
* for 1 minute, or at least up to you press Ctrl-c
*/
#include <stdio.h>
#include <unistd.h>

int
main (void)
{
  int child_return, child_pid = fork();

  if (child_pid != 0) 
    /*
     * I'm the parent process
     */
    sleep (60);
  wait (&child_return);
  return 0;
}

Nenhum comentário:

Postar um comentário