From nobody Tue Mar 25 21:55:35 2025 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 4ZMkHq5Mmqz5rrQP; Tue, 25 Mar 2025 21:55:35 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZMkHq3kQ5z40mJ; Tue, 25 Mar 2025 21:55:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742939735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmm0kzzC53hfkcGlkmGKSyQXIUc/fqHesDPDXQk2wHw=; b=fc7GBZrU69h6AzogLiPJeXITRblhWBTDXjPSa5XmVLE6YCWo2KtIiPmxsJrto8fDKtA0yr hf2uVpU4lMUjGCpkT4mYGDi35lLw8GhAF+BJSdNt2+zQFmeyWriTbyGF4BOXzZDKy9EzAO wiXjrniSkHYM+NskOzrlzEQ5BXlO9Gu83dGLtZGQPqFfbiKWVlYqbXDn4XkWLPhlDbyYH6 XDUCZ7NW0yx8Rm9N1ZkWnZalQHqVmggVFLJ4iSui0eiPk2TeOXfAmLg8030KvFWtyvSG/r +rKmKikjlcCLfgQ9s6q3IBuXoCShDQuRx+UQumHTSTLMX33uIVr0ySSwjavRCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1742939735; a=rsa-sha256; cv=none; b=viNN+pKdx/n/AtnWB2kXzVzwX4jt8UsncW1iuE5S4+woUeqPQTNo4bJu0veVOooT94HUSc T7v9efTYF2rOf0kyaDMJlSXxa5xZuEiI/mKjrmi8FmzQ2G9PQoNjgWqLkIGyIx+Faq6uvz Kv3cbQ+B5eRcputSLCEmzUonH31LhfXibGOj9dgBL7iPK7Q4/NYRxbbjhoSwaa1YVCws1r qyXLuv+K/bEgXz56E550OYQe98nNX43edDrlFW+293K6jhjJJYAZdgHn+VdNvy8xnqrTQD oeCUgSEEfH33uN1ffauTDm38V2xlu9A4+P7rqR4kEs3NwdZfmMTkBLhEbr+HoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742939735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmm0kzzC53hfkcGlkmGKSyQXIUc/fqHesDPDXQk2wHw=; b=iPakNy86iLd0iAH3wRe/xd4xcUWI5r21xUB6t1OFGtW91cMKVxkIgu/SvdYIR4I0HrO95l 8gK1IxjruMB7npqvTlpFXADkeqaTBCk82PkfF61Dh9fp+ppQmH3oPnp9Vv6Q642cnFJ89K bI4CPAU9nobccDtPVTEldsRb9fe2+fQBH3M3IDwXTVVceegUxnW7juVPNoqi4c4oGkr5AX efUDAYMg806r8Cm4JWRA9DwjrPSpe/w0uuWHwakqxPgoDeFNAWYey2a3xZF7ddW45rk2eb fkO408kSengvKMAGCSffFTa+aZeROAPmucyvzmYFJlC8bMe/D+WlR55VIOX0DQ== 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 4ZMkHq35H7zyVj; Tue, 25 Mar 2025 21:55:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 52PLtZAs051509; Tue, 25 Mar 2025 21:55:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 52PLtZSG051506; Tue, 25 Mar 2025 21:55:35 GMT (envelope-from git) Date: Tue, 25 Mar 2025 21:55:35 GMT Message-Id: <202503252155.52PLtZSG051506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 0a85254d5a33 - main - top: Polish key bindings in usage and manual 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a85254d5a33800600477ce57fbaab64591aa6ea Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=0a85254d5a33800600477ce57fbaab64591aa6ea commit 0a85254d5a33800600477ce57fbaab64591aa6ea Author: Alexander Ziaee AuthorDate: 2025-03-23 18:28:53 +0000 Commit: Alexander Ziaee CommitDate: 2025-03-25 21:51:08 +0000 top: Polish key bindings in usage and manual Organize key bindings by ascii(7) for consistency and maintainability, mark them as Interactive Commands, wordsmith them, and sync their organization between the manual and help screen. MFC after: 3 days PR: 282734 Fixes: c8aa5e526 (move command mapping to commands.c) Reviewed by: imp, mhorne, Jim Brown Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D49462 --- usr.bin/top/commands.c | 26 +++---- usr.bin/top/top.1 | 183 +++++++++++++++++++++++++------------------------ 2 files changed, 105 insertions(+), 104 deletions(-) diff --git a/usr.bin/top/commands.c b/usr.bin/top/commands.c index e65f4ee6c4c4..3fa63459f2e1 100644 --- a/usr.bin/top/commands.c +++ b/usr.bin/top/commands.c @@ -51,35 +51,35 @@ static int str_addarg(char *str, int len, char *arg, bool first); const struct command all_commands[] = { - {'C', "toggle the displaying of weighted CPU percentage", false, CMD_wcputog}, + {' ', "update the display", false, CMD_update}, + {'/', "filter on command name (+ selects all commands)", false, CMD_grep}, + {'a', "toggle the display of process titles", false, CMD_showargs}, + {'C', "toggle the display of raw or weighted CPU percentage", false, CMD_wcputog}, {'d', "change number of displays to show", false, CMD_displays}, {'e', "list errors generated by last \"kill\" or \"renice\" command", false, CMD_errors}, - {'H', "toggle the displaying of threads", false, CMD_thrtog}, + {'H', "toggle the display of threads", false, CMD_thrtog}, {'h', "show this help text", true, CMD_help}, {'?', NULL, true, CMD_help}, - {'/', "filter on command name (+ selects all commands)", false, CMD_grep}, - {'i', "toggle the displaying of idle processes", false, CMD_idletog}, + {'i', "toggle the display of idle processes", false, CMD_idletog}, {'I', NULL, false, CMD_idletog}, - {'j', "toggle the displaying of jail ID", false, CMD_jidtog}, {'J', "display processes for only one jail (+ selects all jails)", false, CMD_jail}, + {'j', "toggle the display of jail ID", false, CMD_jidtog}, {'k', "kill processes; send a signal to a list of processes", false, CMD_kill}, - {'q', "quit" , true, CMD_quit}, {'m', "toggle the display between 'cpu' and 'io' modes", false, CMD_viewtog}, {'n', "change number of processes to display", false, CMD_number}, {'#', NULL, false, CMD_number}, {'o', "specify the sort order", false, CMD_order}, + {'P', "toggle the display of per-CPU statistics", false, CMD_pcputog}, {'p', "display one process (+ selects all processes)", false, CMD_pid}, - {'P', "toggle the displaying of per-CPU statistics", false, CMD_pcputog}, + {'q', "quit" , true, CMD_quit}, {'r', "renice a process", false, CMD_renice}, + {'S', "toggle the display of system processes", false, CMD_viewsys}, {'s', "change number of seconds to delay between updates", false, CMD_delay}, - {'S', "toggle the displaying of system processes", false, CMD_viewsys}, - {'a', "toggle the displaying of process titles", false, CMD_showargs}, - {'T', "toggle the displaying of thread IDs", false, CMD_toggletid}, + {'T', "toggle the display of thread IDs", false, CMD_toggletid}, {'t', "toggle the display of this process", false, CMD_selftog}, {'u', "display processes for only one user (+ selects all users)", false, CMD_user}, {'w', "toggle the display of swap use for each process", false, CMD_swaptog}, - {'z', "toggle the displaying of the system idle process", false, CMD_kidletog}, - {' ', "update the display", false, CMD_update}, + {'z', "toggle the display of the system idle process", false, CMD_kidletog}, {0, NULL, true, CMD_NONE} }; @@ -108,7 +108,7 @@ show_help(void) } else if (curcmd->c == ' '){ /* special case space rather than introducing a "display string" to * the struct */ - sprintf(keys, "SPC"); + sprintf(keys, "space"); } else { sprintf(keys, "%c", curcmd->c); } diff --git a/usr.bin/top/top.1 b/usr.bin/top/top.1 index ca74860aaa35..3443df0f8c22 100644 --- a/usr.bin/top/top.1 +++ b/usr.bin/top/top.1 @@ -1,4 +1,4 @@ -.Dd November 18, 2021 +.Dd March 25, 2025 .Dt TOP 1 .Os .Sh NAME @@ -235,7 +235,7 @@ or .Dq all . Boolean flags are toggles. A second specification of any of these options will negate the first. -.Sh "INTERACTIVE MODE" +.Sh INTERACTIVE MODE When .Nm is running in @@ -255,9 +255,8 @@ is between displays; that is, while it is waiting for seconds to elapse. If this is the case, the command will be processed and the display will be updated immediately thereafter -(reflecting any changes that the command may have specified). -This -happens even if the command was incorrect. +.Pq reflecting any changes that the command may have specified . +This happens even if the command was incorrect. If a key is pressed while .Nm is in the middle of updating the display, it will finish the update and @@ -269,65 +268,54 @@ in, the user's erase and kill keys (as set up by the command .Xr stty 1 ) are recognized, and a newline terminates the input. .Pp -These commands are currently recognized (^L refers to control-L): +The bindings are as follows: .Bl -tag -width indent -.It ^L -Redraw the screen. -.It h -Display a summary of the commands (help screen). -Version information -is included in this display. -.It q -Quit -.Nm -.It d -Change the number of displays to show (prompt for new number). -Remember that the next display counts as one, so typing 'd1' will make -.Nm -show one final display and then immediately exit. -.It / -Display only processes that contain the specified string in their -command name. -If displaying arguments is enabled, the arguments are searched -too. '+' shows all processes. -.It m -Toggle the display between 'cpu' and 'io' modes. -.It n or # -Change the number of processes to display (prompt for new number). -.It s -Change the number of seconds to delay between displays -(prompt for new number). -.It S -Toggle the display of system processes. -.It a -Toggle the display of process titles. -.It k +.It Ic space +Update the display. +.It Ic / +Filter by command name. +Prompt for +.Ar string +or +.Ql Ic + +to show all processes. +.It Ic a +Toggle display of process titles. +.It Ic C +Toggle display of raw or weighted CPU percentage. +.It Ic d +Change the number of remaining displays to show before exit. +Prompt for new number. +.It Ic e +Display a list of system errors (if any) generated by the last command. +.It Ic H +Toggle display of threads. +.It Ic h No or Ic \&? +Display a summary of the commands (help screen) and version information. +.It Ic i No or Ic I +Toggle display of idle processes. +.It Ic J +Filter processes owned by a specific jail. +Prompt for jail name or +.Ql Ic + +for all processes belonging to all jails and the host. +This will also enable the display of JID. +.It Ic j +Toggle display of +.Xr jail 8 +ID. +.It Ic k Send a signal .Pq SIGKILL by default to a list of processes. This acts similarly to the command .Xr kill 1 . -.It r -Change the priority -.Pq the Dq nice -of a list of processes. -This acts similarly to -.Xr renice 8 . -.It u -Display only processes owned by a specific set of usernames (prompt for -username). -If the username specified is simply -.Dq + -or -.Dq - , -then processes belonging to all users will be displayed. -Usernames can be added -to and removed from the set by prepending them with -.Dq + -and -.Dq - , -respectively. -.It o +.It Ic m +Toggle the display between 'cpu' and 'io' modes. +.It Ic n No or Ic # +Change the number of processes to display. +Prompt for new number. +.It Ic o Change the order in which the display is sorted. The sort key names include .Dq cpu , @@ -336,41 +324,54 @@ The sort key names include and .Dq time. The default is cpu. -.It p -Display a specific process (prompt for pid). -If the pid specified is simply -.Dq + , -then show all processes. -.It e -Display a list of system errors (if any) generated by the last -command. -.It H -Toggle the display of threads. -.It i or I -Toggle the display of idle processes. -.It j -Toggle the display of -.Xr jail 8 -ID. -.It J -Display only processes owned by a specific jail (prompt for jail). -If the jail specified is simply -.Dq + , -then processes belonging -to all jails and the host will be displayed. -This will also enable the display of JID. -.It P -Toggle the display of per-CPU statistics. -.It T -Toggle display of TID and PID -.It t -Toggle the display of the +.It Ic P +Toggle display of per-CPU statistics. +.It Ic p +Filter by exact process ID. +Prompt for +.Ar PID +or +.Ql Ic + +to show all processes. +.It Ic q +Quit +.Nm . +.It Ic r +Change the priority +.Pq the Dq nice +of a list of processes. +This acts similarly to +.Xr renice 8 . +.It Ic S +Toggle the display of system processes. +.It Ic s +Change the number of seconds to delay between displays. +Prompt for new number. +.It Ic T +Toggle display between thread ID and process ID. +.It Ic t +Toggle display of the .Nm process. -.It w -Toggle the display of swap usage. -.It z -Toggle the display of the system idle process. +.It Ic u +Filter by exact process owner username. +Prompt for +.Ar username +or +.Ql Ic - Ns +.No / Ns +.Ql Ic + +for all users. +Usernames can be added +to and removed from the set by prepending them with +.Ql + +and +.Ql - , +respectively. +.It Ic w +Toggle display of swap usage. +.It Ic z +Toggle display of the system idle process. .El .Sh "THE DISPLAY" The top few lines of the display show general information