PATCH for a more-POSIX `ps', and related adventures

Garance A Drosihn drosih at rpi.edu
Thu Mar 25 13:08:01 PST 2004


At 3:40 PM -0500 3/25/04, Albert Cahalan wrote:
>
>Also, I'd be happy to support a FreeBSD-compatible "Z" if you
>can properly describe it to me.

This description from the source might help (since I have not
written the man-page entry for it yet.  Ahem...):

case 'X':
	/*
	 * Note that `-X' and `-x' are not standard "selector"
	 * options. For most selector-options, we check *all*
	 * processes to see if any are matched by the given
	 * value(s).  After we have a set of all the matched
	 * processes, then `-X' and `-x' govern whether we
	 * modify that *matched* set for processes which do
	 * not have a controlling terminal.  `-X' causes
	 * those processes to be deleted from the matched
	 * set, while `-x' causes them to be kept.
	 */
	xkeep = 0;
	break;
case 'x':
	xkeep = 1;
	break;

Before option-parsing, the variable xkeep starts out as -1, and
xkeep_implied starts out as 0.  Options like `-t' and `-G' set
xkeep_implied = 1, because I think that's what we have to do to
match the spirit of SUSv3.  After option-parsing is done, there
is:

	if (xkeep < 0)	 /* Neither -X nor -x was specified */
		xkeep = xkeep_implied;

The `-p pidlist' option does NOT set xkeep_implied, but the
pidlist is checked before the xkeep variable, so processes are
always matched no matter what value xkeep ends up with.  The
`-A' option will also set xkeep (not xkeep_implied).

-- 
Garance Alistair Drosehn            =   gad at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-standards mailing list