Re: top.1: Fix COMMAND description

2020-06-23 Thread Jason McIntyre
On Tue, Jun 23, 2020 at 09:42:06PM +0200, Klemens Nanni wrote:
> There simply is no code that adds angle brackets the swapped out
> processes in the COMMAND column.
> 
> I double checked with a tiny VMM instance using 64M of RAM where
> ld(1) from the library_aslr script immediately hits swap: no <> around.
> 
> While here, mention that -C appends arguments.
> 
> Feedback? OK?
> 

that seems correct:

RCS file: /cvs/src/usr.bin/top/machine.c,v

revision 1.54
date: 2006/11/29 12:34:22;  author: miod;  state: Exp;  lines: +1 -10;
Do not test for processes being swapped out since this can't happen anymore.

=
Index: machine.c
===
RCS file: /cvs/src/usr.bin/top/machine.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- machine.c   20 Sep 2006 21:26:20 -  1.53
+++ machine.c   29 Nov 2006 12:34:22 -  1.54
@@ -1,4 +1,4 @@
-/* $OpenBSD: machine.c,v 1.53 2006/09/20 21:26:20 ray Exp $ */
+/* $OpenBSD: machine.c,v 1.54 2006/11/29 12:34:22 miod Exp $*/
 
 /*-
  * Copyright (c) 1994 Thorsten Lockert 
@@ -475,15 +475,6 @@
pp = *(hp->next_proc++);
hp->remaining--;
 
-   if ((pp->p_flag & P_INMEM) == 0) {
-   /*
-* Print swapped processes as 
-*/
-   char buf[sizeof(pp->p_comm)];
-
-   (void) strlcpy(buf, pp->p_comm, sizeof(buf));
-   (void) snprintf(pp->p_comm, sizeof(pp->p_comm), "<%s>", buf);
-   }
cputime = (pp->p_uticks + pp->p_sticks + pp->p_iticks) / stathz;
 
/* calculate the base for cpu percentages */

ok for the (amended) diff.
jmc

> 
> Index: top.1
> ===
> RCS file: /cvs/src/usr.bin/top/top.1,v
> retrieving revision 1.73
> diff -u -p -r1.73 top.1
> --- top.1 7 Jan 2020 13:30:43 -   1.73
> +++ top.1 23 Jun 2020 19:33:04 -
> @@ -450,9 +450,9 @@ The number of system and user CPU second
>  The raw percentage of CPU usage and the default field on which the
>  display is sorted.
>  .It COMMAND
> -The name of the command that the process is currently running.
> -(If the process is swapped out, this column is enclosed by angle
> -brackets.)
> +The name (and arguments if
> +.Fl H
> +is specified) of the command that the process is currently running.
>  .El
>  .Sh ENVIRONMENT
>  .Bl -tag -width Ev
> 



Re: top.1: Fix COMMAND description

2020-06-23 Thread Klemens Nanni
On Tue, Jun 23, 2020 at 09:42:06PM +0200, Klemens Nanni wrote:
> There simply is no code that adds angle brackets the swapped out
> processes in the COMMAND column.
> 
> I double checked with a tiny VMM instance using 64M of RAM where
> ld(1) from the library_aslr script immediately hits swap: no <> around.
> 
> While here, mention that -C appends arguments.
> 
> Feedback? OK?
Without fat fingering the Fl macro this time, thanks Matthew Martin!



Index: top.1
===
RCS file: /cvs/src/usr.bin/top/top.1,v
retrieving revision 1.73
diff -u -p -r1.73 top.1
--- top.1   7 Jan 2020 13:30:43 -   1.73
+++ top.1   23 Jun 2020 20:12:44 -
@@ -450,9 +450,9 @@ The number of system and user CPU second
 The raw percentage of CPU usage and the default field on which the
 display is sorted.
 .It COMMAND
-The name of the command that the process is currently running.
-(If the process is swapped out, this column is enclosed by angle
-brackets.)
+The name (and arguments if
+.Fl C
+is specified) of the command that the process is currently running.
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width Ev