diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2014-05-02 23:30:39 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2014-05-02 23:30:39 +0000 |
commit | 1042af2b8ec8c05226f9f2c66b1c8faa2b33feb3 (patch) | |
tree | 1be93af025ad8a4895637f23b4ea30cad0f145da /usr.bin | |
parent | ed48e9a0db7699d2d1249014920957127f258657 (diff) | |
download | FreeBSD-src-1042af2b8ec8c05226f9f2c66b1c8faa2b33feb3.zip FreeBSD-src-1042af2b8ec8c05226f9f2c66b1c8faa2b33feb3.tar.gz |
Add -J command/flag to filter by jail name/jid. This will automatically
display the JID as well (the -j command/flag).
0 displays host.
+ displays all.
MFC after: 2 weeks
Relnotes: yes
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/top/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/top/machine.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/top/Makefile b/usr.bin/top/Makefile index 864473f..de08724 100644 --- a/usr.bin/top/Makefile +++ b/usr.bin/top/Makefile @@ -21,8 +21,8 @@ WARNS?= 0 CFLAGS+= -D"Table_size=${TOP_TABLE_SIZE}" .endif -DPADD= ${LIBTERMCAP} ${LIBM} ${LIBKVM} -LDADD= -ltermcap -lm -lkvm +DPADD= ${LIBTERMCAP} ${LIBM} ${LIBKVM} ${LIBJAIL} +LDADD= -ltermcap -lm -lkvm -ljail CLEANFILES= sigdesc.h SIGCONV_AWK= ${.CURDIR}/../../contrib/top/sigconv.awk diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 190ea26..78976e1 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -668,6 +668,7 @@ get_process_info(struct system_info *si, struct process_select *sel, /* these are copied out of sel for speed */ int show_idle; + int show_jid; int show_self; int show_system; int show_uid; @@ -710,6 +711,7 @@ get_process_info(struct system_info *si, struct process_select *sel, /* set up flags which define what we are going to select */ show_idle = sel->idle; + show_jid = sel->jid != -1; show_self = sel->self == -1; show_system = sel->system; show_uid = sel->uid != -1; @@ -764,6 +766,10 @@ get_process_info(struct system_info *si, struct process_select *sel, /* skip processes that aren't doing I/O */ continue; + if (show_jid && pp->ki_jid != sel->jid) + /* skip proc. that don't belong to the selected JID */ + continue; + if (show_uid && pp->ki_ruid != (uid_t)sel->uid) /* skip proc. that don't belong to the selected UID */ continue; |