From owner-freebsd-current@FreeBSD.ORG Tue Mar 16 14:05:27 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 832B716A4CE for ; Tue, 16 Mar 2004 14:05:27 -0800 (PST) Received: from smtp3.server.rpi.edu (smtp3.server.rpi.edu [128.113.2.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FF8B43D2D for ; Tue, 16 Mar 2004 14:05:25 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp3.server.rpi.edu (8.12.8/8.12.8) with ESMTP id i2GM5MLP008841 for ; Tue, 16 Mar 2004 17:05:22 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: Date: Tue, 16 Mar 2004 17:05:20 -0500 To: current@freebsd.org From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: CanIt (www . canit . ca) Subject: Re: PATCH for 'ps -p ' in current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2004 22:05:27 -0000 At 9:40 PM -0500 3/8/04, Garance A Drosihn wrote: > >On stable, if you say 'ps -p ', and there is no process '', >then you get the header-line from 'ps' and nothing else. The >command-status is set to indicate failure. > >On -current, the same command gives you the error message: > >ps: kvm_getprocs: No such process > >and you get no header line. Other OS's also give you the header >line and no special error message. > >In some other OS's, 'ps' behaves the way it does for us in -stable. >Looking at SUSv3, it's not clear to me if either behavior is >preferred. Here is the patch that I came up with for ps.c. While I was at it, I changed 'ps' so it accepts a list of pid's, as is described in SUSv3. I print out a warning message for any "pid value" which would never match valid pid, but I do not consider it an error unless all of the given pid's are invalid. It's probably bogus to #define 'BSD_PID_MAX' in here, but I did want to catch the case where a user types in a valid number which the system would never ever match to a process. Is there some routine I could call to get that value (the real value, not just "the max value that fits in pid_t"). Other than that quirk, this is patterned after how 'ps' presently handles a list of userids. The patch has been tested on freebsd/i386 and freebsd/sparc64. Since I imagine this email would be too long or too "spam-looking" if I included the entire patch in this message, I have it at: http://people.freebsd.org/~gad/ps-p.diff -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu