Re: top(1): remove last vestiges of "last pid"

2022-09-09 Thread Todd C . Miller
On Fri, 09 Sep 2022 20:19:26 -0500, Scott Cheloha wrote:

> millert@ removed most of the "last pid" pieces from top(1) in 1997:
>
> http://cvsweb.openbsd.org/src/usr.bin/top/machine.c?rev=1.7=text
> /x-cvsweb-markup
>
> Some small bits remain, though.  Can we remove the rest?

Sure.  OK millert@

 - todd



top(1): remove last vestiges of "last pid"

2022-09-09 Thread Scott Cheloha
millert@ removed most of the "last pid" pieces from top(1) in 1997:

http://cvsweb.openbsd.org/src/usr.bin/top/machine.c?rev=1.7=text/x-cvsweb-markup

Some small bits remain, though.  Can we remove the rest?

Index: display.c
===
RCS file: /cvs/src/usr.bin/top/display.c,v
retrieving revision 1.66
diff -u -p -r1.66 display.c
--- display.c   8 Aug 2022 16:54:09 -   1.66
+++ display.c   10 Sep 2022 01:09:21 -
@@ -234,7 +234,7 @@ format_uptime(char *buf, size_t buflen)
 
 
 void
-i_loadave(pid_t mpid, double *avenrun)
+i_loadave(double *avenrun)
 {
if (screen_length > 1 || !smart_terminal) {
int i;
@@ -243,10 +243,6 @@ i_loadave(pid_t mpid, double *avenrun)
clrtoeol();
 
addstrp("load averages");
-   /* mpid == -1 implies this system doesn't have an _mpid */
-   if (mpid != -1)
-   printwp("last pid: %5ld;  ", (long) mpid);
-
for (i = 0; i < 3; i++)
printwp("%c %5.2f", i == 0 ? ':' : ',', avenrun[i]);
}
Index: display.h
===
RCS file: /cvs/src/usr.bin/top/display.h,v
retrieving revision 1.15
diff -u -p -r1.15 display.h
--- display.h   17 Nov 2018 23:10:08 -  1.15
+++ display.h   10 Sep 2022 01:09:21 -
@@ -35,7 +35,7 @@
 
 /* prototypes */
 int display_resize(void);
-void i_loadave(int, double *);
+void i_loadave(double *);
 void u_loadave(int, double *);
 void i_timeofday(time_t *);
 void i_procstates(int, int *, int);
Index: machine.c
===
RCS file: /cvs/src/usr.bin/top/machine.c,v
retrieving revision 1.111
diff -u -p -r1.111 machine.c
--- machine.c   22 Feb 2022 17:35:01 -  1.111
+++ machine.c   10 Sep 2022 01:09:21 -
@@ -306,7 +306,6 @@ get_system_info(struct system_info *si)
si->cpustates = cpu_states;
si->cpuonline = cpu_online;
si->memory = memory_stats;
-   si->last_pid = -1;
 }
 
 static struct handle handle;
Index: machine.h
===
RCS file: /cvs/src/usr.bin/top/machine.h,v
retrieving revision 1.31
diff -u -p -r1.31 machine.h
--- machine.h   26 Aug 2020 16:21:28 -  1.31
+++ machine.h   10 Sep 2022 01:09:21 -
@@ -49,7 +49,6 @@ struct statics {
  */
 
 struct system_info {
-   pid_t   last_pid;
double  load_avg[NUM_AVERAGES];
int p_total;
int p_active;   /* number of procs considered
Index: top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.106
diff -u -p -r1.106 top.c
--- top.c   26 Aug 2020 16:21:28 -  1.106
+++ top.c   10 Sep 2022 01:09:24 -
@@ -560,7 +560,7 @@ restart:
proc_compares[order_index]);
 
/* display the load averages */
-   i_loadave(system_info.last_pid, system_info.load_avg);
+   i_loadave(system_info.load_avg);
 
/* display the current time */
/* this method of getting the time SHOULD be fairly portable */