[PATCH] Add -p option to ps command

Jerry D. Hedden jerry@hedden.us
Thu Feb 16 14:58:00 GMT 2006

> On Feb 14 07:12, Jerry D. Hedden wrote:
> > Attached is a patch to add a -p option to the ps command to show
> > information for only a single PID:  ps -p PID

> Corrina Vinschen replied:
> Thanks for the patch.  It's barely short enough so that we decided to
> put it in despite the fact that you have no copyright assignment
> in place.

I will send one in today.

> I applied your patch with some minor changes.

Thanks.  I realized one minor oversight.  Using -p should imply -a so
that even if the PID is not owned by the current user, it will still
get listed.  I've attached a patch for this (just a one line addition)
that builds on top of the previous patch (i.e., apply it against
version 1.20 of ps.cc).  Thanks again.
-------------- next part --------------
Index: src/winsup/utils/ps.cc
--- ps.cc  1.20
+++ ps.cc
@@ -286,6 +286,7 @@
       case 'p':
 	proc_id = atoi (optarg);
+	aflag = 1;
       case 's':
 	sflag = 1;

More information about the Cygwin-patches mailing list