Hello, On Tue, 30 Jun 2009, Greg Freemyer wrote:
On Tue, Jun 30, 2009 at 3:09 PM, David Haller<lists@dhaller.de> wrote:
On Tue, 02 Dec 2008, Volker Poplawski wrote:
How do i get the PID of a process by the process-name?
Look at the sourcecode of pidof / pgrep. Basically both programms look through /proc/nnn/{cmdline,exe} and look for matching names.
Along those same lines, strace will get you to the answer even faster a lot of times. And you don't have to have the source handy either.
I used 'strace pidof xemacs' for my answer, don't have the sources around ... ;) I use strace, ltrace, ltrace -S quite often. But to reimplement the functionality, it'd probably be better to have a look at the tried and tested implementations in the sources of pidof and/or pgrep and probably use copy and paste, eh? ;) On the other hand, I do quite often also look into sources. -dnh -- In the Beginning there was nothing, which exploded. -- Terry Pratchett, Lords and Ladies -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org