Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5105763pxb; Wed, 19 Jan 2022 11:07:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjr5qUXGk3bka2w1cBpiFFH9Bj16aqvnCLRQD1q039w1eEFm4UewEXJYbSZwjMpXTMyoBG X-Received: by 2002:aa7:8612:0:b0:4c1:3613:2e4b with SMTP id p18-20020aa78612000000b004c136132e4bmr32457732pfn.74.1642619274608; Wed, 19 Jan 2022 11:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642619274; cv=none; d=google.com; s=arc-20160816; b=VhSXoy9c2XCt/d0jJAfpEJ05wQQFh6HQSyeDVTlk1nBzT3aLCCNN1oQ1Iswh+j+bar 37WVDOasBdPvyey/60RFExOPwiGaldNLVdirSNMAdAPmdzh18QP4NnRtr0+0YWX1ltGX dPSyAxbE3hIqTXj812AypKZcrG7kmM7g9FBBXouHoSv2IJQHVfUya48qMYA60WunXUZc jGWVxuTse053HHpIP/rg26GBB5Lw85QkROWk+3y1uwQxiE3yePZMRDABp5mTjDUoDcdz avReyr/z0Va18N82a1pzO2F3Re+6nKCKmEGY9BEdykG4m7Iinp0uBJzG0cjYYb1MyZdW yOrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3k0Dy3TjxtVXK/oSB5yxWQOvPswP/hDwxFrAxNftPx0=; b=wJGMalb4qS+3C+wYVR5jFZAhTndQGueR3RA3Xz/IiIiMxqw5D3n6WmMEgyYd6Hscfa zrowAENfx+44vDF4Z8XVrUDmboq/anUqp4qDAR5Z/A/KBHOf2gXWICNXqdxwesxhnb36 IqBy5WMuXqxNm+TTGhi8Y9vELVTvY/2q6x+BbtH4P7xHA6RZjks+E8mGQhVLN3XCqD6U k+hUJfS0luzvp4c8FM3qG3zRe3e+PYA1qKrB0BFLrl+uwNDHOm9CTP6JWUaYaQ56BP7L MJ6UJCQeoujqgR4pjz/w/3DnpEEgq8s26nLEGS16aOIO/k2YGuuTWR7lQKp0R7RlmKAx uI/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@home.drummond.us header.s=default header.b=HrfroqxJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=drummond.us Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si6136315pjo.85.2022.01.19.11.07.42; Wed, 19 Jan 2022 11:07:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@home.drummond.us header.s=default header.b=HrfroqxJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=drummond.us Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236150AbiAREpQ (ORCPT + 99 others); Mon, 17 Jan 2022 23:45:16 -0500 Received: from drummond.us ([74.95.14.229]:59983 "EHLO talisker.home.drummond.us" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235790AbiAREpL (ORCPT ); Mon, 17 Jan 2022 23:45:11 -0500 Received: from talisker.home.drummond.us (localhost [127.0.0.1]) by talisker.home.drummond.us (8.15.2/8.15.2/Debian-20) with ESMTP id 20I4hKxA765034; Mon, 17 Jan 2022 20:43:20 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=home.drummond.us; s=default; t=1642481000; bh=JFi+HKlyMuoco5DMezAYc0cpMIkALY2NRgqxQb8XaVQ=; h=From:To:Cc:Subject:Date:From; b=HrfroqxJrad3DzZ6FT4waFIt4MeHoVb4BxDueoszUUfOdgocQu4B3/GEGCbfH7j+4 bCnukvS8DMk0QncCM+4cnd67oBI11AUaZSfyA1jy6TaXA3X5Kcb8WqFT1lOO/G4bU0 sE937UadIfrwnyajiN2sClndEDW/LSMvKjwv+nnxvNZNZDwNa20sogsmB1xI0fuutp TyP5IwYKNFjesXLYErOM4Z88Ci8VqrvFMwxoLr+OAwdySfNxgdpWQg9mNN1heppfgk /c+IM2lyAghg9dy8t50eqPnrKRsXzAsmMkXQhyUwc1ZmqI7/AHP52rv9ZYELVdXPsV F6MVEFQaeeKrg== Received: (from walt@localhost) by talisker.home.drummond.us (8.15.2/8.15.2/Submit) id 20I4hDNe765026; Mon, 17 Jan 2022 20:43:13 -0800 From: Walt Drummond To: agordeev@linux.ibm.com, arnd@arndb.de, benh@kernel.crashing.org, borntraeger@linux.ibm.com, chris@zankel.net, davem@davemloft.net, gregkh@linuxfoundation.org, hca@linux.ibm.com, deller@gmx.de, ink@jurassic.park.msu.ru, James.Bottomley@HansenPartnership.com, jirislaby@kernel.org, mattst88@gmail.com, jcmvbkbc@gmail.com, mpe@ellerman.id.au, paulus@samba.org, rth@twiddle.net, dalias@libc.org, tsbogend@alpha.franken.de, gor@linux.ibm.com, ysato@users.osdn.me Cc: linux-kernel@vger.kernel.org, ar@cs.msu.ru, walt@drummond.us, linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Subject: [PATCH 0/3] status: TTY status message request Date: Mon, 17 Jan 2022 20:42:57 -0800 Message-Id: <20220118044259.764945-1-walt@drummond.us> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset adds TTY status message request feature to the n_tty line dicipline. This feature prints a brief message containing basic system and process group information to a user's TTY in response to a new control character in the line dicipline (default Ctrl-T) or the TIOCSTAT ioctl. The message contains the current system load, the name and PID of an interesting process in the forground process group, it's run time, percent CPU usage and RSS. An example of this message is: load: 0.31 cmd: sleep 3616843 [sleeping] 0.36r 0.00u 0.00s 0% 696k User API visible changes are limited to: - The addition of VSTATUS in termios.c_cc[] - The addition of NOKERNINFO bit in termios.l_cflags - The addition of the TIOCSTAT ioctl number None of these changes break the existing kernel api as the termios structure on all architectures has enough space in the control character array (.c_cc) for the new character, and the other changes are space agnostic. This feature is in many other Unix-like systems, both current and historical. In other implementations, this feature would also send SIGINFO to the process group; this implementation does not. Walt Drummond (3): vstatus: Allow the n_tty line dicipline to write to a user tty vstatus: Add user space API definitions for VSTATUS, NOKERNINFO and TIOCSTAT status: Display an informational message when the VSTATUS character is pressed or TIOCSTAT ioctl is called. arch/alpha/include/asm/termios.h | 4 +- arch/alpha/include/uapi/asm/ioctls.h | 1 + arch/alpha/include/uapi/asm/termbits.h | 34 ++--- arch/ia64/include/asm/termios.h | 4 +- arch/ia64/include/uapi/asm/termbits.h | 34 ++--- arch/mips/include/asm/termios.h | 4 +- arch/mips/include/uapi/asm/ioctls.h | 1 + arch/mips/include/uapi/asm/termbits.h | 36 ++--- arch/parisc/include/asm/termios.h | 4 +- arch/parisc/include/uapi/asm/ioctls.h | 1 + arch/parisc/include/uapi/asm/termbits.h | 34 ++--- arch/powerpc/include/asm/termios.h | 4 +- arch/powerpc/include/uapi/asm/ioctls.h | 2 + arch/powerpc/include/uapi/asm/termbits.h | 34 ++--- arch/s390/include/asm/termios.h | 4 +- arch/sh/include/uapi/asm/ioctls.h | 1 + arch/sparc/include/uapi/asm/ioctls.h | 1 + arch/sparc/include/uapi/asm/termbits.h | 38 +++--- arch/xtensa/include/uapi/asm/ioctls.h | 1 + drivers/tty/Makefile | 2 +- drivers/tty/n_tty.c | 113 +++++++++++----- drivers/tty/n_tty_status.c | 162 +++++++++++++++++++++++ drivers/tty/tty_io.c | 2 +- include/asm-generic/termios.h | 4 +- include/linux/tty.h | 123 ++++++++--------- include/uapi/asm-generic/ioctls.h | 1 + include/uapi/asm-generic/termbits.h | 34 ++--- 27 files changed, 461 insertions(+), 222 deletions(-) create mode 100644 drivers/tty/n_tty_status.c -- 2.30.2