c - WalkingDead Program - Finding zombies and orphans -
for school paper need write program monitors processes in /proc directory , recording notices when processes become zombie or orphan.
i know commands need use don't know how implement in program.
there code finds in terminal either there zombie or there not.
ps aux | awk '"[zz]" ~ $8 { printf("%s, pid = %d\n", $8, $2); }'
there code creates zombie process:
#include <unistd.h> #include <stdlib.h> #include <stdio.h> int main() { int pid; /* let's create child process */ pid = fork(); if (!pid) { /* child: dies , becomes zombie */ exit(0); } /* parent process: asks user input */ printf("please, press enter after looking @ zombie process..."); (void)getchar(); }
i have code creates orphan won't put here.
i don't need code program need explain or guide me step step need finish homework positive result.
thanks help!
just make loop executing command have with
#include <stdlib.h> int system(const char *command);
that´s need
Comments
Post a Comment