From: cheloha Date: Sat, 10 Sep 2022 16:58:51 +0000 (+0000) Subject: top(1): remove last vestiges of "last pid" support X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=09447e1ca72940b7ca8e02d50402ee3836bf9ebb;p=openbsd top(1): remove last vestiges of "last pid" support millert@ removed most of the "last pid" support from top(1) in 1997. See, e.g. top/machine.c,v1.7: http://cvsweb.openbsd.org/src/usr.bin/top/machine.c?rev=1.7&content-type=text/x-cvsweb-markup Let's remove the rest of it: - Eliminate system_info.last_pid. - Remove mpid parameter and "last pid" printing code from i_loadave(). Link: https://marc.info/?l=openbsd-tech&m=166277253606823&w=2 ok millert@ --- diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c index 3cc91fc2105..fdb726c8eba 100644 --- a/usr.bin/top/display.c +++ b/usr.bin/top/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.66 2022/08/08 16:54:09 cheloha Exp $ */ +/* $OpenBSD: display.c,v 1.67 2022/09/10 16:58:51 cheloha Exp $ */ /* * Top users/processes display for Unix @@ -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]); } diff --git a/usr.bin/top/display.h b/usr.bin/top/display.h index 60374d8ddbc..29a74f8e00e 100644 --- a/usr.bin/top/display.h +++ b/usr.bin/top/display.h @@ -1,4 +1,4 @@ -/* $OpenBSD: display.h,v 1.15 2018/11/17 23:10:08 cheloha Exp $ */ +/* $OpenBSD: display.h,v 1.16 2022/09/10 16:58:51 cheloha Exp $ */ /* * Top users/processes display for Unix @@ -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); diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 079560a8d3b..fbddbc172d3 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.c,v 1.111 2022/02/22 17:35:01 deraadt Exp $ */ +/* $OpenBSD: machine.c,v 1.112 2022/09/10 16:58:51 cheloha Exp $ */ /*- * Copyright (c) 1994 Thorsten Lockert @@ -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; diff --git a/usr.bin/top/machine.h b/usr.bin/top/machine.h index f051d99bad0..9082c81956f 100644 --- a/usr.bin/top/machine.h +++ b/usr.bin/top/machine.h @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.h,v 1.31 2020/08/26 16:21:28 kn Exp $ */ +/* $OpenBSD: machine.h,v 1.32 2022/09/10 16:58:51 cheloha Exp $ */ /* * Top users/processes display for Unix @@ -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 diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index 59c46bde594..c5267b17d3e 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.106 2020/08/26 16:21:28 kn Exp $ */ +/* $OpenBSD: top.c,v 1.107 2022/09/10 16:58:51 cheloha Exp $ */ /* * Top users/processes display for Unix @@ -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 */