Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/top/dist/machine Implement the `c' command in "...
details: https://anonhg.NetBSD.org/src/rev/929219fd364c
branches: trunk
changeset: 349852:929219fd364c
user: leot <leot%NetBSD.org@localhost>
date: Mon Dec 26 12:46:31 2016 +0000
description:
Implement the `c' command in "interactive mode" that displays only commands
that match a specified string.
Reviewed by and thanks to <Riastradh>
diffstat:
external/bsd/top/dist/machine/m_netbsd.c | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diffs (88 lines):
diff -r 1a281ef68e14 -r 929219fd364c external/bsd/top/dist/machine/m_netbsd.c
--- a/external/bsd/top/dist/machine/m_netbsd.c Mon Dec 26 12:44:10 2016 +0000
+++ b/external/bsd/top/dist/machine/m_netbsd.c Mon Dec 26 12:46:31 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $ */
+/* $NetBSD: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $ */
/*
* top - a top users display for Unix
@@ -37,12 +37,12 @@
* Andrew Doran <ad%NetBSD.org@localhost>
*
*
- * $Id: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $
+ * $Id: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: m_netbsd.c,v 1.18 2013/10/20 03:02:27 christos Exp $");
+__RCSID("$NetBSD: m_netbsd.c,v 1.19 2016/12/26 12:46:31 leot Exp $");
#endif
#include <sys/param.h>
@@ -587,6 +587,7 @@
int show_idle;
int show_system;
int show_uid;
+ char *show_command;
static struct handle handle;
@@ -626,6 +627,7 @@
show_idle = sel->idle;
show_system = sel->system;
show_uid = sel->uid != -1;
+ show_command = sel->command;
/* count up process states and get pointers to interesting procs */
total_procs = 0;
@@ -646,9 +648,12 @@
if (pp->p_stat != LSZOMB &&
(show_idle || (pp->p_pctcpu != 0) ||
(pp->p_stat == LSRUN || pp->p_stat == LSONPROC)) &&
- (!show_uid || pp->p_ruid == (uid_t)sel->uid)) {
- *prefp++ = pp;
- active_procs++;
+ (!show_uid || pp->p_ruid == (uid_t)sel->uid) &&
+ (!show_command ||
+ strstr(get_command(sel, pp),
+ show_command) != NULL)) {
+ *prefp++ = pp;
+ active_procs++;
}
}
}
@@ -685,6 +690,7 @@
int show_idle;
int show_system;
int show_uid;
+ char *show_command;
static struct handle handle;
@@ -736,6 +742,7 @@
show_idle = sel->idle;
show_system = sel->system;
show_uid = sel->uid != -1;
+ show_command = sel->command;
/* count up thread states and get pointers to interesting threads */
total_lwps = 0;
@@ -758,9 +765,12 @@
if (lp->l_stat != LSZOMB &&
(show_idle || (lp->l_pctcpu != 0) ||
(lp->l_stat == LSRUN || lp->l_stat == LSONPROC)) &&
- (!show_uid || uid_from_thread(lp) == sel->uid)) {
- *lrefp++ = lp;
- active_lwps++;
+ (!show_uid || uid_from_thread(lp) == sel->uid) &&
+ (!show_command ||
+ strstr(get_command(sel, proc_from_thread(lp)),
+ show_command) != NULL)) {
+ *lrefp++ = lp;
+ active_lwps++;
}
}
}
Home |
Main Index |
Thread Index |
Old Index