[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Questions on `pgrep' and `pkill'
- Subject: Questions on `pgrep' and `pkill'
- From: drosih at rpi.edu (Garance A Drosihn)
- Date: Thu Mar 25 18:15:06 2004
Well, I have added pkill & pgrep to src/usr.bin, and have it
pretty much working (thanks to lioux, who had already done all
the real work in the port for sysutils/pkill).
I have two minor questions.
For the 5.x-branch, I assume that:
plist = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
should be asking for KERN_PROC_PROC. Or should I add an `-H'
option to govern that? Would it make any sense for these commands
to list out threads? (or it would it make sense for `pgrep' but
not for `pkill'? I have no experience with threaded processes...)
The other question is just something I'm confused about. I have
my own little "psgrep" script, so once I had `pgrep' working I
compared what my script does to the new command. It happens that
I'm running OpenAFS on this machine, and here's basically what I
got:
(35) psgrep afsd
641 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
642 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
643 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
644 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
645 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
646 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
647 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
648 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
649 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
650 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
(36) pgrep -fl afsd
644 /usr/local/sbin/afsd -stat 1200 -dcache 800 ...
I don't understand why pgrep matched only one of these. If you
turn on the `-D' option that I added to pgrep, it seems that all
the rest of those afsd processes have the P_SYSTEM flag set. Why
would all of those processes but one have that flag set? Or why
doesn't that one *also* have it set? It isn't even the first or
last process that was started up.
This wasn't the behavior I would expect. Are there some other
flag(s) I should be checking for whatever these commands are
using P_SYSTEM for? (I think we'll all be better off if I don't
try to become a kernel developer to answer this...)
--
Garance Alistair Drosehn = gad_(_at_)_gilead_(_dot_)_netel_(_dot_)_rpi_(_dot_)_edu
Senior Systems Programmer or gad_(_at_)_freebsd_(_dot_)_org
Rensselaer Polytechnic Institute or drosih_(_at_)_rpi_(_dot_)_edu
Visit your host, monkey.org