How to find process name in c

Tony Rems rembo at unisoft.com
Sat Oct 13 18:37:42 AEST 1990


In article <2190 at megadon.UUCP> you write:
>Has anyone got a method for finding out if a process is running short of
>"ps -ef | grep processname" in a pipe.  There must be a better way from
>within a c program.

Well, you can perform the above task in C by, doing a
popen("ps -ef", "r");

check the popen man page.  Your other alternative is 
to go digging into the kernel to check the process 
table.  Why do the work when ps has already done it 
for you? 

-Tony



More information about the Comp.unix mailing list