All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arseny Maslennikov <ar@cs.msu.ru>
To: Pavel Machek <pavel@denx.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	"Vladimir D . Seleznev" <vseleznv@altlinux.org>
Subject: Re: [PATCH 0/7] TTY Keyboard Status Request
Date: Sun, 9 Jun 2019 23:56:10 +0300	[thread overview]
Message-ID: <20190609205610.GB3736@cello> (raw)
In-Reply-To: <20190609195132.GA1430@amd>

[-- Attachment #1: Type: text/plain, Size: 2422 bytes --]

On Sun, Jun 09, 2019 at 09:51:32PM +0200, Pavel Machek wrote:
> Hi!
> 
> > > > This patch series introduces TTY keyboard status request, a feature of
> > > > the n_tty line discipline that reserves a character in struct termios
> > > > (^T by default) and reacts to it by printing a short informational line
> > > > to the terminal and sending a Unix signal to the tty's foreground
> > > > process group. The processes may, in response to the signal, output a
> > > > textual description of what they're doing.
> > > > 
> > > > The feature has been present in a similar form at least in
> > > > Free/Open/NetBSD; it would be nice to have something like this in Linux
> > > > as well. There is an LKML thread[1] where users have previously
> > > > expressed the rationale for this.
> > > > 
> > > > The current implementation does not break existing kernel API in any
> > > > way, since, fortunately, all the architectures supported by the kernel
> > > > happen to have at least 1 free byte in the termios control character
> > > > array.
> > > 
> > > I like the idea... I was often wondering "how long will this dd take". (And in
> > > case of dd, SIGUSR1 does the job).
> > > 
> > > I assume this will off by default, so that applications using ^T today will not
> > > get surprise signals?
> > 
> > If any of isig, icanon and iexten is disabled on the tty, the signal is
> > not sent.
> 
> As expected.
> 
> > Any application that wants to handle raw terminal input events itself,
> > e.g. vim, mutt, libreadline, anything ncurses-based, etc., has to turn
> > off the tty's cooked mode, i.e. at least icanon. This means those
> > applications are unaffected.
> 
> Agreed, those are unaffected.
> 
> But if I have an application doing read() from console (without
> manipulating tty), am I going to get surprise signal when user types
> ^T?
> 
> 	     	      	      	     	      	     	       	     Pavel

As of now, that application will indeed receive a signal that is
guaranteed to be ignored by default.

This is similar to SIGWINCH, which is default-ignored as well: if the
terminal width/height changes (like when a terminal emulator window is
resized), its foreground pgrp gets a surprise signal as well, and the
processes that don't care about WINCH (and thus have default
disposition) do not get confused.
E.g. 'strace cat' demonstrates this quite clearly.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-06-09 20:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05  8:18 [PATCH 0/7] TTY Keyboard Status Request Arseny Maslennikov
2019-06-05  8:19 ` [PATCH 1/7] signal.h: Define SIGINFO on all architectures Arseny Maslennikov
2019-06-10 21:10   ` Rob Landley
2019-06-11 20:36   ` Eric W. Biederman
2019-06-11 20:36     ` Eric W. Biederman
2019-06-11 22:38     ` Arseny Maslennikov
2019-06-05  8:19 ` [PATCH 2/7] tty: termios: Reserve space for VSTATUS in .c_cc Arseny Maslennikov
2019-06-05  8:19 ` [PATCH 3/7] n_tty: Send SIGINFO to fg pgrp on status request character Arseny Maslennikov
2019-06-05  8:19 ` [PATCH 4/7] linux/signal.h: Ignore SIGINFO by default in new tasks Arseny Maslennikov
2019-06-05  8:19 ` [PATCH 5/7] tty: Add NOKERNINFO lflag to termios Arseny Maslennikov
2019-06-05  8:19 ` [PATCH 6/7] n_tty: ->ops->write: Cut core logic out to a separate function Arseny Maslennikov
2019-06-05  8:19 ` [PATCH 7/7] n_tty: Provide an informational line on VSTATUS receipt Arseny Maslennikov
2019-06-09 17:41 ` [PATCH 0/7] TTY Keyboard Status Request Pavel Machek
2019-06-09 19:40   ` Arseny Maslennikov
2019-06-09 19:51     ` Pavel Machek
2019-06-09 20:56       ` Arseny Maslennikov [this message]
2019-06-10 21:18         ` Rob Landley
2019-06-12  9:41         ` Pavel Machek
2019-06-10 21:06 ` Rob Landley

Reply instructions:

You may reply publicly 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=20190609205610.GB3736@cello \
    --to=ar@cs.msu.ru \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pavel@denx.de \
    --cc=peterz@infradead.org \
    --cc=vseleznv@altlinux.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.