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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

oracle - Changing start date for system jobs related to automatic statistics collections in 11g -