[comp.unix.internals] C program to get pid of a process

grx0736@uoft02.utoledo.edu (04/25/91)

unix gurus,

	i would like to get pid of a running process without
using "ps".  I know the name of the running process. I intend 
to this thru' a C program (without giving a "system" call and
running shell script in it) which could use some library functions
to get information about the pid of a running process. 

	the system i am working on is Sun386i with SunOS 4.0.2
I believe kvm_open, kvm_nextproc etc. are the library functions 
to be used to get such information. Don't know how to use these
functions though.

	In short, i am looking for something like

	get_process_id("process_name");

	any info. would be highly appreciated.

sunil kulkarni