Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Oct 2011 20:54:05 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        svn-src-head@freebsd.org, Ed Schouten <ed@80386.nl>, svn-src-all@freebsd.org, src-committers@freebsd.org, Edward Tomasz Napierala <trasz@FreeBSD.org>
Subject:   Re: svn commit: r225868 - head/bin/ps
Message-ID:  <20111001205405.GA72884@freebsd.org>
In-Reply-To: <20111001203441.GA88035@stack.nl>
References:  <201109290631.p8T6VgJ3008377@svn.freebsd.org> <20110929121457.GA53600@freebsd.org> <20111001130643.GC91943@hoeg.nl> <20111001171401.GA47100@freebsd.org> <20111001203441.GA88035@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111001205405.GA72884>