From owner-freebsd-arch@FreeBSD.ORG Fri Mar 26 06:34:26 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 C893816A4CE for ; Fri, 26 Mar 2004 06:34:26 -0800 (PST) Received: from hexagon.stack.nl (hexagon.stack.nl [131.155.140.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id 08E8643D2D for ; Fri, 26 Mar 2004 06:34:26 -0800 (PST) (envelope-from jilles@stack.nl) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010:2e0:81ff:fe22:51d8]) by hexagon.stack.nl (Postfix) with ESMTP id 40643F70#6EA9F519E; Fri, 26 Mar 2004 15:34:24 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id 3F61B1CC2E; Fri, 26 Mar 2004 15:34:24 +0100 (CET) Date: Fri, 26 Mar 2004 15:34:24 +0100 From: Jilles Tjoelker To: Dan Nelson Message-ID: <20040326143423.GD71731@stack.nl> References: <20040325070120.GA67497@VARK.homeunix.com> <20040325211636.GC3446@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040325211636.GC3446@dan.emsphone.com> X-Operating-System: FreeBSD 5.2.1-RELEASE-p1 i386 User-Agent: Mutt/1.5.6i cc: arch@FreeBSD.ORG cc: Garance A Drosihn Subject: Re: Adding `pgrep' and `pkill' to /usr/bin 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 14:34:26 -0000 On Thu, Mar 25, 2004 at 03:16:36PM -0600, Dan Nelson wrote: > In the last episode (Mar 24), David Schultz said: > > I think it would be *great* to import any and all of the Solaris proc > > tools into FreeBSD. I tend to think of these utilities as ps(1), > > fstat(1), and friends done the proper Unix way (with lots of simple > > tools that can be combined for powerful effect.) For those who > > haven't seen the rest of the tools, take a look at: > > http://www.freebsd.org/cgi/man.cgi?query=proc&manpath=SunOS+5.9 > Some of these already exist or would be trivial to add: > pstack is in ports, and can decode libc_r threads. It works, but the fact that most binaries are stripped doesn't help it. > pwdx could be a wrapper around fstat? How would you obtain the full pathname of the directory? fstat cannot do it, but lsof can. In principle it is possible, since every directory has at most one name. > pstop and prun are just wrappers around kill -{STOP|CONT} $@ No, they're not. kill -STOP notifies the parent process if it's in a wait()-like function with the WUNTRACED option set (e.g. job control shell), and SIGCONT is often caught (to redraw the screen, for example). pstop and prun don't have any of those effects. It's the same kind of "stop" that debuggers use. > pwait would make wait_for_pids() in rc.subr simpler I've made an implementation of pwait using kqueue(2): http://www.stack.nl/~jilles/unix/pwait.tar.gz. It's pretty simple. I doubt whether it's worth putting another program in /bin to make that function simpler, though. > pstree is in ports and looks similar to ptree It would still require some work. -- Jilles Tjoelker