From owner-svn-src-head@FreeBSD.ORG Sat Oct 1 20:34:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A3F3106566B; Sat, 1 Oct 2011 20:34:43 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id B606E8FC0A; Sat, 1 Oct 2011 20:34:42 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 9A1D91DD74B; Sat, 1 Oct 2011 22:34:41 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 8054917512; Sat, 1 Oct 2011 22:34:41 +0200 (CEST) Date: Sat, 1 Oct 2011 22:34:41 +0200 From: Jilles Tjoelker To: Alexander Best Message-ID: <20111001203441.GA88035@stack.nl> References: <201109290631.p8T6VgJ3008377@svn.freebsd.org> <20110929121457.GA53600@freebsd.org> <20111001130643.GC91943@hoeg.nl> <20111001171401.GA47100@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111001171401.GA47100@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, Ed Schouten , svn-src-all@freebsd.org, src-committers@freebsd.org, Edward Tomasz Napierala Subject: Re: svn commit: r225868 - head/bin/ps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2011 20:34:43 -0000 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. > 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. -- Jilles Tjoelker