Subject: proposal for new ps(1) option -H
To: None <tech-userlevel@netbsd.org>
From: Jan Kryl <loo@bazmek.net>
List: tech-userlevel
Date: 09/06/2007 14:12:03
--vtzGhvizbBRQ85DL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

currently we use -s option to display one line for each LWP. The
disadvantage is, that -s option does two things at once. It prints one
line for each LWP and following information for each lwp:  uid, pid,
ppid, cpu, lid, nlwp, pri, nice, vsz, rss, wchan, lstate, tt, time and
command.

So, currently there is no way to display one line per LWP and
simultaneously your own configuration of output columns.
Therefore I suggest a new option, which prints one line per LWP, but
does nothing more. In Solaris they use -L, which is already used for
listing available keywords, so we could use -H as in FreeBSD.

The patch, which does the job, is fairly trivial (see attachment).

What do you guys think about this change?

Cheers,
Jan


--vtzGhvizbBRQ85DL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="H-option.patch"

Index: ps.c
===================================================================
RCS file: /home/loo/cvsup/src/bin/ps/ps.c,v
retrieving revision 1.63
diff -u -r1.63 ps.c
--- ps.c	17 Feb 2007 22:49:57 -0000	1.63
+++ ps.c	4 Sep 2007 16:17:08 -0000
@@ -110,7 +110,7 @@
  * ARGOPTS must contain all option characters that take arguments
  * (except for 't'!) - it is used in kludge_oldps_options()
  */
-#define	GETOPTSTR	"acCeghjk:LlM:mN:O:o:p:rSsTt:U:uvW:wx"
+#define	GETOPTSTR	"acCeghHjk:LlM:mN:O:o:p:rSsTt:U:uvW:wx"
 #define	ARGOPTS		"kMNOopUW"
 
 struct kinfo_proc2 *kinfo;
@@ -197,6 +197,9 @@
 		case 'h':
 			prtheader = ws.ws_row > 5 ? ws.ws_row : 22;
 			break;
+		case 'H':
+			showlwps = 1;
+			break;
 		case 'j':
 			parsefmt(jfmt);
 			fmt = 1;

--vtzGhvizbBRQ85DL--