Happy Zombie Jesus day!

Today is zombie jesus day! So in the spirit of the day, I thought I’d write a little program so your computer too can have a zombie jesus.

File: jesus.c

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    pid_t  pid;

    pid = getpid();
    fork();
    if (pid == getpid()) {
        strncpy(argv[0],"god",strlen(argv[0]));
        sleep(30);
    } else {
    }

    return 0;
}

And then…

$ ./jesus &
$ ps ax | grep jesus
19565 pts/0    Z      0:00 [jesus] <defunct>

VoilĂ ! Your very own zombie jesus! (for 30 seconds)

(See also: http://en.wikipedia.org/wiki/Zombie_process

One Response to “Happy Zombie Jesus day!”

  1. JW says:

    I love it!