LKML Archive on lore.kernel.org
 help / color / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Austin S Hemmelgarn <ahferroin7@gmail.com>
Cc: Martin Tournoij <martin@arp242.net>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] The SIGINFO signal from BSD
Date: Wed, 5 Nov 2014 15:14:04 -0500
Message-ID: <20141105201404.GH27083@thunk.org> (raw)
In-Reply-To: <545A7B00.1040309@gmail.com>

On Wed, Nov 05, 2014 at 02:31:12PM -0500, Austin S Hemmelgarn wrote:
> >
> >SIGINFO prints the status of the process to the terminal; BSD cp, for example,
> >shows show much data it's copied:
> >
> >     $ cp large_file /dev/null
> >     <press ^t>
> >     load: 1.39  cmd: cp 85837 [running] 3.91r 0.00u 0.98s 8% 2340k
> >     large_file -> /dev/null  15%
> >
> >As you see, it shows the current load, pid, process status, memory usage, as
> >well as how much of the file has been copied. Many other BSD tools print similar
> >statistics (mv, tar, dd, sleep, fetch, etc.).
> 
> You have to understand however, that the reason that SIGINFO works like that
> on *BSD is that the kernel and core userspace are developed together,
> whereas on Linux, they are maintained entirely separately. Outside of core
> userspace components, using SIGINFO that way on *BSD is just convention.

Actually, the first line:

	load: 1.39  cmd: cp 85837 [running] 3.91r 0.00u 0.98s 8% 2340k

is actually printed by the kernel.  It's actually something which is
implemented in the BSD N_TTY line displine.  We never implemented it
(at least when I was maintaining the tty subsystem) mostly out of
laziness.  Part of the reason is that the main reason was that main
reason why people (at least systems programmers / kernel programers
like me) used ^T was to debug an apparently hung system, and for
Linux, we had a much more powerful system using the magic-sysrq key.

Changing various userspace utilities to set up a signal handler for
SIGINFO and then printing some extra information, such as:

	large_file -> /dev/null  15%

is a much more recent innovation (at least, newer than BSD 4.3 in the
early 90's, which is the last time I hacked on BSD :-), and is largely
separate from the question of implementing ^T in the N_TTY line
displine.

In a world where we have a GUI desktop, I suspect implementing ^T is
much less interesting, but if someone were to submit a patch to at
least make ^T send a SIGINFO, I can't think of a reason why it
wouldn't be accepted.  (BTW, if you're going to do this, note that ^T
could be remapped to any control character via stty; so to do this we
would need to define an extra index in c_cc[] array in the struct
termios.)

Cheers,

					- Ted

  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 15:17 Martin Tournoij
2014-11-05 19:31 ` Austin S Hemmelgarn
2014-11-05 20:14   ` Theodore Ts'o [this message]
2014-11-05 20:30     ` Austin S Hemmelgarn
2014-11-05 22:13     ` Martin Tournoij
2014-11-06 13:19       ` Pádraig Brady
2014-11-10 14:22     ` One Thousand Gnomes
2014-11-10 14:34       ` Martin Tournoij
2014-11-10 16:16       ` Austin S Hemmelgarn
2014-11-23  9:48       ` Pavel Machek

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141105201404.GH27083@thunk.org \
    --to=tytso@mit.edu \
    --cc=ahferroin7@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@arp242.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox