[41518] in Cypherpunks

home help back first fref pref prev next nref lref last post

Re: I am looking for a way to create a zombie process

daemon@ATHENA.MIT.EDU (Michael Shields)
Sun Oct 15 13:44:51 1995

From: shields@tembel.org (Michael Shields)
To: fc@all.net (Dr. Frederick B. Cohen)
Date: Sun, 15 Oct 1995 17:41:09 +0000 (GMT)
Cc: cypherpunks@toad.com, bugtraq@fc.net
In-Reply-To: <9510151556.AA26716@all.net> from "Dr. Frederick B. Cohen" at 1995-10-15 11:56:37

> 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.

home help back first fref pref prev next nref lref last post