c - Outputting both stopped and Running processes in linux? -
i'm presently using linux command in c program show group of processes. when process stopped (suspended) though, command not list it. need list both running , stopped jobs. note: when stopped, not mean terminated jobs. issue displaying suspended processes.
execvp("/bin/ps", parmlist);
i have use ps command. there anyway show both running , stopped (suspended) processes in situation?
there 2 ways go it:
1) continuously monitor processes change in state.
2) register handler notified asynchronously, when state changes.
1st case
execute script continously monitors process states. have use ps bsd style options ie
ps axo pid,stat
2nd case
you can monitor child processes. can monitor them using waitpid()
provided child processes.
so, register handler signals , in handler use waitpid status.
you find signals explained here: [http://linux.die.net/man/2/waitpid][1]
Comments
Post a Comment