I am looking for a way to create a zombie process

Michael Shields shields at tembel.org
Sun Oct 15 10:41:54 PDT 1995


> Is there anyone who can give me a simple program or set of commands that
> creates a zombie process? Thanks in advance. 

Here, public domain.

#include <stdio.h>
#include <unistd.h>

int
main()
{
    if (!fork()) {
	/* Child; die. */
	exit(0);
    } else {
	/* Child dies, is zombie for ten seconds. */
	sleep(10);
	/* Reap it. */
	wait();
	/* Now no zombie. */
	sleep(10);
	exit(0);
    }
}
-- 
Shields.





More information about the cypherpunks-legacy mailing list