"T. Alex Chen" writes:

> I am trying to retrieve the process ID from a process' name, optionally with 
> its command parameters.
> I look up the man page of 'sysctl' and the use of this API seems to be 
> discouraged. It points the /proc file system.
> The /proc does contains all the running processes, with their ID as the 
> directory name, and their command line as a file 'cmdline' under that 
> subdirectory.
> Is there an API get the information out easily or do I have to open the file 
> '/proc' and iterate through the sub-directories with number (PID) as the file 
> name and get the content of 'cmdline'. (That seems
> to be very cumbersome.)

Maybe the source of `pidof' (in sysvinit-utils) can give a hint.

-- 
Alberto


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87pqtw8o7l....@eps142.cdf.udc.es

Reply via email to