From owner-freebsd-arch@FreeBSD.ORG Thu Mar 25 18:06:00 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7211A16A4CE for ; Thu, 25 Mar 2004 18:06:00 -0800 (PST) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 275C843D31 for ; Thu, 25 Mar 2004 18:06:00 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.12.8/8.12.8) with ESMTP id i2Q25QoP004748; Thu, 25 Mar 2004 21:05:26 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: Date: Thu, 25 Mar 2004 21:05:25 -0500 To: arch@freebsd.org From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: CanIt (www . canit . ca) cc: Julian Elischer Subject: Re: Questions on `pgrep' and `pkill' X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2004 02:06:00 -0000 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@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu