Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4008918ybd; Tue, 25 Jun 2019 12:21:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1pFYJjvIFMUI/HAyklh7ikDBHN+mk85S2O9FjhvP2iG0wX7itBr6KCnRR24v0LLFOif+s X-Received: by 2002:a63:550:: with SMTP id 77mr9191087pgf.341.1561490460136; Tue, 25 Jun 2019 12:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561490460; cv=none; d=google.com; s=arc-20160816; b=XxIZniFgqNuiP9MOGs02jg6IEx1NKL+3OA+XVADaQmYdGjLghgExjUgS7iL6ZL5N09 EBt1bQVHvLnRYXIER9/fi5FKhWrU3MzS0CLGNAkODBAQ/pI1fMKAtCTs3yAk9ODe6cDm 8wasSKVZfsLYonT8tTZn67Q4pNxn+6b9FkBDESQ/LI3IOmZ03W/lZjkPkumKne6XGeoG RX+vkWDKn6HCiTNR3WY1sBP3Nm+o6czZqTTHEiRftwTyDPjsx886i66OcWgTNZ2FNSII Vd+Tf4FeKFEJM6UptbACSyuRmG4z58fgO+MGIBYLfIHcHIrk0mwuGB0D9qS1QDlvXrGN nn1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:message-id:date:cc:to:from:dkim-signature; bh=sAAsGr5aya7rHncrNbs1gvq6cIgrrMYiXY3ywGrXYhQ=; b=byOtd6ncV7CRjws0ILTmQhTkwoH7zLy2L86XrDen/LpIYrYDpD+ib7/sWEn6g/43xq CL9sx1rksjHKM5x+tiLQoMZRNCOzURC3+H/ruVM52uaNphpVBlYLaYSlveNDyh/gIOJz 59JKMb3PTBtwYfMlvKK5Rn1pRnyc5atan7aWN/NhltNz6K0xrW/Ouwm32hWPFkayoQPY Iw48FcpadcgXNmF0sWfMMErVwjm0IwuTBWuBGt68VJXzorOL1zKMqwByPyd5F5F9/VQd Z7EeDvXCKtHC4xO7E3noePMM18Y3wVvALQ3JnbZr7TcgYwb2g4As9sQsF3NY606xpELS RPEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cs.msu.ru header.s=dkim header.b=QMNp5d8c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cs.msu.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cp14si1017172plb.183.2019.06.25.12.20.44; Tue, 25 Jun 2019 12:21:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@cs.msu.ru header.s=dkim header.b=QMNp5d8c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cs.msu.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732601AbfFYQMy (ORCPT + 99 others); Tue, 25 Jun 2019 12:12:54 -0400 Received: from mx.cs.msu.ru ([188.44.42.42]:28063 "EHLO mail.cs.msu.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731629AbfFYQMk (ORCPT ); Tue, 25 Jun 2019 12:12:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cs.msu.ru; s=dkim; h=Subject:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-Id:Date:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sAAsGr5aya7rHncrNbs1gvq6cIgrrMYiXY3ywGrXYhQ=; b=QMNp5d8cwIP5v16UkqgbU+KLuu wtu37K7gscVrjsH7LuRWQ/hbTe8vpYlpwsgcJMlbLVirR3xZeTfuZcbgxFdt6KmMtq2gTDfVLs0nk Ll7XMiZIl/h5j9O/aHcbA4p8gX0rhT7ad78w5CINqwHFuydSdyZWQRkOipGat9tdadYxi2R8lsyt4 T4MJBZJqldvndWZT1B61gl9pGAzEwEJgKYYniNDNLvg4bV1HM8b9waNBfqpFjErMldhpRb92UeEvP tYWVb5t8rYkf5EjEik0q7oWCcY4/RTVtq8yZYVFmEayQHOJ+DtD9yatQP+wLFQKr6KDpK4nT9kjm9 yLzldqXQ==; Received: from [10.7.4.141] (port=44632 helo=cello.cs.msu.ru) by mail.cs.msu.ru with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92 (FreeBSD)) (envelope-from ) id 1hfo3E-0006Uf-70; Tue, 25 Jun 2019 19:12:08 +0300 From: Arseny Maslennikov To: Greg Kroah-Hartman , Jiri Slaby , Ingo Molnar , Peter Zijlstra , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Vladimir D. Seleznev" , Rob Landley , "Eric W. Biederman" , Pavel Machek , Arseny Maslennikov Date: Tue, 25 Jun 2019 19:11:46 +0300 Message-Id: <20190625161153.29811-1-ar@cs.msu.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 10.7.4.141 X-SA-Exim-Mail-From: ar@cs.msu.ru X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.cs.msu.ru X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_ALL autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH v2 0/7] TTY Keyboard Status Request X-SA-Exim-Version: 4.2 X-SA-Exim-Scanned: Yes (on mail.cs.msu.ru) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. The series should cleanly apply to tty-next. To thoroughly test these, one might need at least a patched stty among other tools, so I've brought up a simple initrd generator[2] which can be used to create a lightweight environment to boot up in a VM and to fiddle with. [1] https://lore.kernel.org/lkml/1415200663.3247743.187387481.75CE9317@webmail.messagingengine.com/ [2] https://github.com/porrided/tty-kb-status-userspace v2 <- v1: removed useless debugging bits. Discussion of v1: https://lore.kernel.org/lkml/20190605081906.28938-1-ar@cs.msu.ru/ Arseny Maslennikov (7): signal.h: Define SIGINFO on all architectures tty: termios: Reserve space for VSTATUS in .c_cc n_tty: Send SIGINFO to fg pgrp on status request character linux/signal.h: Ignore SIGINFO by default in new tasks tty: Add NOKERNINFO lflag to termios n_tty: ->ops->write: Cut core logic out to a separate function n_tty: Provide an informational line on VSTATUS receipt arch/alpha/include/asm/termios.h | 4 +- arch/alpha/include/uapi/asm/termbits.h | 2 + arch/arm/include/uapi/asm/signal.h | 1 + arch/h8300/include/uapi/asm/signal.h | 1 + arch/ia64/include/asm/termios.h | 4 +- arch/ia64/include/uapi/asm/signal.h | 1 + arch/ia64/include/uapi/asm/termbits.h | 2 + arch/m68k/include/uapi/asm/signal.h | 1 + arch/mips/include/asm/termios.h | 4 +- arch/mips/include/uapi/asm/signal.h | 1 + arch/mips/include/uapi/asm/termbits.h | 2 + arch/parisc/include/asm/termios.h | 4 +- arch/parisc/include/uapi/asm/signal.h | 1 + arch/parisc/include/uapi/asm/termbits.h | 2 + arch/powerpc/include/asm/termios.h | 4 +- arch/powerpc/include/uapi/asm/signal.h | 1 + arch/powerpc/include/uapi/asm/termbits.h | 2 + arch/s390/include/asm/termios.h | 4 +- arch/s390/include/uapi/asm/signal.h | 1 + arch/sparc/include/asm/termios.h | 4 +- arch/sparc/include/uapi/asm/signal.h | 2 + arch/sparc/include/uapi/asm/termbits.h | 2 + arch/x86/include/uapi/asm/signal.h | 1 + arch/xtensa/include/uapi/asm/signal.h | 1 + arch/xtensa/include/uapi/asm/termbits.h | 2 + drivers/tty/Makefile | 3 +- drivers/tty/n_tty.c | 70 ++++- drivers/tty/n_tty_status.c | 337 +++++++++++++++++++++++ include/asm-generic/termios.h | 4 +- include/linux/sched.h | 7 + include/linux/signal.h | 5 +- include/linux/tty.h | 7 +- include/uapi/asm-generic/signal.h | 1 + include/uapi/asm-generic/termbits.h | 2 + 34 files changed, 457 insertions(+), 33 deletions(-) create mode 100644 drivers/tty/n_tty_status.c -- 2.20.1