A few suggestions:
man system
look at source: rpm -qf `which ps`
  now you know the package name, look for .src.rpm on RH disks,
  (probably some really easy way to do this with debian)

Or a strace might be more readable than some of this gunky old source:
go.c:
#include <stdio.h>
void main(void) { system("ps -e"); }

strace -f go 2>&1 | tee go.log

(looks like system is bad cause it spawns big bad /bin/sh,
whereas you can spawn it directly with exec* functions.)


On Thu, Mar 06, 2003 at 04:08:24PM -0600, Sreekumar Kodakara wrote:
> Hi
> I am in need of a way to find if a list of processes are running in a
> linux machine (periodically from a C program). The only way which I knew
> was to use the system() function call and call "ps -a" or a variant of
> that. I came to know that system() is not a safe function call. Is there
> any other way in which I can get that information ( say read any file from
> the /proc directory or something like that??). This is an embedded system with
> no user interaction so it has to be done automatically and in a safe way.
> 
> Also is there a way to make a program not to dump core if it seg faults?
> 
> I am running Linux 2.2.14 kernel ( Stripped down version of RH 6.2) in my
> machine.
> 
> Thanks for the information.
> 
> Sreekumar
> 
> 
> _______________________________________________
> Twin Cities Linux Users Group Mailing List - Minneapolis/St. Paul, Minnesota
> http://www.mn-linux.org tclug-list at mn-linux.org
> https://mailman.real-time.com/mailman/listinfo/tclug-list


_______________________________________________
Twin Cities Linux Users Group Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list