From nobody Mon Nov 1 01:28:36 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 39A53183D660; Mon, 1 Nov 2021 01:28:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjFmP14nSz4sDk; Mon, 1 Nov 2021 01:28:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0232D592; Mon, 1 Nov 2021 01:28:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A11Saoi058814; Mon, 1 Nov 2021 01:28:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A11Safl058813; Mon, 1 Nov 2021 01:28:36 GMT (envelope-from git) Date: Mon, 1 Nov 2021 01:28:36 GMT Message-Id: <202111010128.1A11Safl058813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 59821002f7d6 - stable/13 - systat: Handle SIGWINCH to properly window resizing and adjust -swap disk stat based on new size. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 59821002f7d61ce57ed99d2798de64dec6bb3433 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=59821002f7d61ce57ed99d2798de64dec6bb3433 commit 59821002f7d61ce57ed99d2798de64dec6bb3433 Author: Michael Reifenberger AuthorDate: 2021-04-21 18:31:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-01 01:26:53 +0000 systat: Handle SIGWINCH to properly window resizing and adjust -swap disk stat based on new size. (cherry picked from commit 66483838039b21a20d748448f8916a73ec419691) --- usr.bin/systat/devs.c | 8 +------- usr.bin/systat/devs.h | 4 +++- usr.bin/systat/main.c | 16 ++++++++++++++++ usr.bin/systat/swap.c | 4 ++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c index b293796c2c77..87d04f989ea3 100644 --- a/usr.bin/systat/devs.c +++ b/usr.bin/systat/devs.c @@ -426,12 +426,6 @@ dsshow2(int diskcol, int diskrow, int dn, int lc, struct statinfo *now, struct s putlongdouble(device_busy, diskrow + 4, lc, 5, 0, 0); } -static void -dsshow3(int diskcol, int diskrow, int dn, int lc, struct statinfo *now, struct statinfo *then) -{ - dsshow2(diskcol, diskrow, dn, lc, now, then); -} - void dsshow(int maxdrives, int diskcol, int diskrow, struct statinfo *now, struct statinfo *then) { @@ -439,5 +433,5 @@ dsshow(int maxdrives, int diskcol, int diskrow, struct statinfo *now, struct sta for (i = 0, lc = 0; i < num_devices && lc < maxdrives; i++) if (dev_select[i].selected) - dsshow3(diskcol, diskrow, i, ++lc, now, then); + dsshow2(diskcol, diskrow, i, ++lc, now, then); } diff --git a/usr.bin/systat/devs.h b/usr.bin/systat/devs.h index cbedd844290e..79a44a6c3f5e 100644 --- a/usr.bin/systat/devs.h +++ b/usr.bin/systat/devs.h @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 1998 David E. O'Brien - * 2015 Yoshihiro Ota + * 2015, 2021 Yoshihiro Ota * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,8 @@ #include +#define DISKHIGHT 5 + int dsinit(int); void dsgetinfo(struct statinfo *); int dscmd(const char *, const char *, int, struct statinfo *); diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c index b5a19d381ada..b84351379f41 100644 --- a/usr.bin/systat/main.c +++ b/usr.bin/systat/main.c @@ -135,6 +135,21 @@ parse_cmd_args (int argc, char **argv) } +static void +resize(int signo __unused) +{ + + endwin(); + refresh(); + clear(); + + CMDLINE = LINES - 1; + labels(); + display(); + status(); +} + + int main(int argc, char **argv) { @@ -191,6 +206,7 @@ main(int argc, char **argv) signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die); + signal(SIGWINCH, resize); /* * Initialize display. Load average appears in a one line diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index f28059bfecd4..19374918ff68 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -136,7 +136,7 @@ labelswap(void) werase(wnd); - dslabel(12, 0, 18); + dslabel(12, 0, LINES - DISKHIGHT - 1); if (kvnsw <= 0) { mvwprintw(wnd, 0, 0, "(swap not configured)"); @@ -157,7 +157,7 @@ showswap(void) if (kvnsw != okvnsw) labelswap(); - dsshow(12, 0, 18, &cur_dev, &last_dev); + dsshow(12, 0, LINES - DISKHIGHT - 1, &cur_dev, &last_dev); if (kvnsw <= 0) return;