svn commit: r225868 - head/bin/ps

Alexander Best arundel at freebsd.org
Sat Oct 1 20:54:05 UTC 2011


On Sat Oct  1 11, Jilles Tjoelker wrote:
> On Sat, Oct 01, 2011 at 05:14:01PM +0000, Alexander Best wrote:
> > On Sat Oct  1 11, Ed Schouten wrote:
> > > Also, it would be better if we replaced the "??" string with "-". When
> > > we print "??", it actually means: this process has no controlling
> > > terminal, not that we don't know which TTY it is.
> 
> > good point. also i was thinking: if a process had a controlling
> > terminal, but that terminal has been revoked, are users really
> > interested to know what the name of that revoked terminal was? can't
> > we just use "-"? is it important to know whether a process never had a
> > controlling terminal, or had one at some point, but not anymore?
> 
> I think this is potentially useful, because it shows that the process
> did not explicitly detach from the terminal (such as via setsid(2)).
> 
> Particularly if the terminal is real (not a pseudo-terminal), its name
> may be useful in recognition.
> 
> When asking for processes attached to a specific terminal with ps's t
> option, ps will also show processes that used to be attached ("-"),
> possibly allowing users to keep track of processes better.
> 
> It appears that even if a terminal is "revoked" in this way, it still
> prevents reuse of the pts number.

that's a very good explanation. :) so yeah...let's keep it the way it is.

> 
> > also the ps(1) man page claims that a process running on console has a "TT"
> > entry of "con". i've never seen such an entry. is this still correct?
> 
> This may indeed be no longer the case, although it was never common to
> see "con". With syscons in multi-user mode, you cannot log in on
> /dev/console, only on /dev/ttyv*. With syscons in single-user mode,
> ps(1) says "v0" or "ttyv0" but tty(1) says /dev/console.
> 
> > and the last point i'd like to make: looking at 'ps alx' on freebsd
> > 7.x makes it easy to distinguish between ttys and pts'es, because they
> > are names ttyvX and ttypX. looking at the same output under HEAD, all
> > pts terminal descriptors have moved to /dev/pts/X. so they will not
> > show up as pX, but merely as X.
> 
> > can't we tell ps to prefix anything coming from /dev/pts with a "p"?
> 
> > in this output:
> 
> >  1001 1780 1778   1  16  0   15956   3136 pause    Is    0    0:00,02 /usr/local/bin/zsh
> 
> > users are supposed to know that the "0" stands for /dev/pts/0. imho
> 
> >  1001 1780 1778   1  16  0   15956   3136 pause    Is   p0    0:00,02 /usr/local/bin/zsh
> 
> > would be much better here (like under freebsd 7.x).
> 
> I rather like the new output. Pseudo-terminals are by far the most
> common kind of terminal and there may be many of them, so it makes sense
> not to have a prefix. The t option in ps also accepts these short names,
> like 'ps lt0'. All other terminal names start with a letter.
> 
> In FreeBSD 7, the first 256 pseudo-terminals are named
> /dev/tty[pqrsPQRS][0-9a-v]. A few more letters can be used to provide a
> few more pseudo-terminals but even then two characters suffice.
> 
> The TTY keyword shows the full pathname relative to /dev.

i think we should adjust the following paragraph

"     tt       An abbreviation for the pathname of the controlling terminal,
               if any.  The abbreviation consists of the three letters follow-
               ing /dev/tty, or, for the console, ``con''.  This is followed
               by a `-' if the process can no longer reach that controlling
               terminal (i.e., it has been revoked).
"

to something like this then

"     tt       An abbreviation for the pathname of the controlling terminal,
               if any.  The abbreviation consists of the three letters follow-
               ing /dev/tty, or, for pseudo-terminals, the entry in /dev/pts.
               This is followed by a `-' if the process can no longer reach
               that controlling terminal (i.e., it has been revoked).
               The full pathname of the controlling terminal is available via
               the tty keyword.
"

cheers.
alex

ps: i am also wondering, why -o and -O aren't mutually exclusive. this would
make more sense to me.

> 
> -- 
> Jilles Tjoelker


More information about the svn-src-head mailing list