Re: hide kernel threads in ps?

2011-09-18 Thread Philip Guenther
Having muttered a bunch, I'm in favor of this.  One last comment:

On Wed, Aug 31, 2011 at 2:17 AM, Uwe Stuehler u...@openbsd.org wrote:
 --- bin/ps/ps.1 6 Jul 2011 21:42:11 -   1.76
 +++ bin/ps/ps.1 31 Aug 2011 09:01:06 -
...
 +.It Fl H
 +Also display information about kernel visible process threads.
 +This flag only applies when the
 +.Sq kern.rthreads
 +sysctl variable is non-zero and there are processes that use kernel
 +threading.

I think the second sentence there should be left out.  The flag always
applies: you just won't see any difference if you don't have any
kernel visible threads.  ps(1) isn't the place for how to create
different types of threads, IMO.

And yes, I think kernel visible process threads should be just
kernel visible threads.


If there are no objections, I'll commit this with the ps.1 diff reduced to:

--- ps.16 Jul 2011 21:42:11 -   1.76
+++ ps.118 Sep 2011 23:27:44 -
@@ -39,7 +39,7 @@
 .Sh SYNOPSIS
 .Nm ps
 .Sm off
-.Op Fl aCcehjkLlmrSTuvwx
+.Op Fl aCceHhjkLlmrSTuvwx
 .Sm on
 .Op Fl M Ar core
 .Op Fl N Ar system
@@ -89,6 +89,8 @@ scripts will show as
 .Dq sh .
 .It Fl e
 Display the environment as well.
+.It Fl H
+Also display information about kernel visible threads.
 .It Fl h
 Repeat the information header as often as necessary to guarantee one
 header per page of information.


Philip Guenther



Re: hide kernel threads in ps?

2011-09-18 Thread Uwe Stuehler
On Sun, Sep 18, 2011 at 04:28:28PM -0700, Philip Guenther wrote:
 If there are no objections, I'll commit this with the ps.1 diff reduced to:
...
 +.It Fl H
 +Also display information about kernel visible threads.

The distinction betwen kernel threads and kernel visible
threads is certainly obvious to everyone, but this also
seems more consise to me.

Having said that, I'm fine with the shortened paragraph.

Cheers



Re: hide kernel threads in ps?

2011-08-31 Thread Ted Unangst
On Wed, Aug 31, 2011, Uwe Stuehler wrote:
 Help! My Nagios checks failed. :)
 
 This fixes them by hiding kernel threads from ps output.
 
 I'd also like to show the main process ID in the PID column as
 otherwise there is no way of knowing which threads belong together.
 Likely struct kinfo_proc would need a change for that... Maybe in
 another step.
 
 comments?

Is H the best letter?  maybe t?



Re: hide kernel threads in ps?

2011-08-31 Thread Mark Kettenis
 Date: Wed, 31 Aug 2011 16:38:41 -0400
 From: Ted Unangst t...@tedunangst.com
 
 On Wed, Aug 31, 2011, Uwe Stuehler wrote:
  Help! My Nagios checks failed. :)
  
  This fixes them by hiding kernel threads from ps output.
  
  I'd also like to show the main process ID in the PID column as
  otherwise there is no way of knowing which threads belong together.
  Likely struct kinfo_proc would need a change for that... Maybe in
  another step.
  
  comments?
 
 Is H the best letter?  maybe t?

It's what FreeBSD uses.  And t and T are already taken.



Re: hide kernel threads in ps?

2011-08-31 Thread Uwe Stuehler
On Wed, Aug 31, 2011 at 11:50 PM, Philip Guenther guent...@gmail.com wrote:
 As is -L, which is used for threads (LWPs) by Solaris and FreeBSD.
B sigh

 Part of me would be tempted to reuse -k, changing it from
 unsuppressing P_SYSTEM procs to unsuppressing P_THREAD procs. B Then
 process 0 would show up by default too...

Hmm. I agree that it may not be necessary to control the display of P_SYSTEM
procs separately, but as mnemonic, -k sounds like kernel, kthread, and
there's no
k in tHread. :)

If -k would become free for other uses, just for consideration:
- in FreeBSD and Solaris, -k is unused
- in NetBSD, -k specifies the sort order
- in Linux' procps, k specifies the sort order

As for -H:
- in FreeBSD, -H shows kernel visible threads (and ps -Hx shows threads
   of kernel threads as well, whereas ps -x shows just the main
thread/proc)
- in NetBSD, -H is unused
- in Linux, -H switches to a tree display
- in Solaris, -H enables the locality group column (LGRP)

(I've done just a quick cross-check. Maybe I missed something.)



Re: hide kernel threads in ps?

2011-08-31 Thread john slee
On 1 September 2011 10:21, Uwe Stuehler u...@openbsd.org wrote:
 If -k would become free for other uses, just for consideration:
 - in FreeBSD and Solaris, -k is unused
 - in NetBSD, -k specifies the sort order
 - in Linux' procps, k specifies the sort order

-k in AIX /usr/bin/ps is documented as Lists kernel processes in the manpage.

This ps implementation has a split personality like Linux procps, in
that SysVish
and BSDish syntax both work.

AIX /usr/sysv/ps doesn't have a -k option.

Tru64 4.0 doesn't seem to support -k at all.

AIX is the only commercial UNIX I'm seeing in job listings these days, for what
that's worth.  Solaris seems to be a corpse, and the flies are
swarming.  I guess
people really don't need DTrace and ZFS after all ;-)

John