Skip to content

pidof does not check comm field in /proc/.../stat file like sysvinit did

the sysvinit implementation of pidof would use the comm field in the processes's stat file to find matches. the new procps implementation ignores this. some projects (like acpid) rely on this behavior.

an example:

$ cd /proc/3490
$ cut -d' ' -f1-10 stat
3490 (kded4) S 1 3486 3486 0 -1 4218944 14930
$ ls -l exe
lrwxrwxrwx 1 vapier users 0 May 15 05:20 exe -> /usr/bin/kdeinit4
$ cat cmdline; echo
kdeinit4: kded4 [kdeinit]

so when you run pidof kded4, the new procps implementation can't locate this process. but the sysvinit one would.