Bug 173973 - [patch] 'not function' for user display for top(1)
Summary: [patch] 'not function' for user display for top(1)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-28 16:10 UTC by nvass
Modified: 2018-05-21 00:02 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (3.14 KB, patch)
2012-11-28 16:10 UTC, nvass
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nvass 2012-11-28 16:10:00 UTC
It's sometimes useful to be able to ignore the processes of a specific user in top(1). This is might be especially true for system processes owned by root.
 
Regular top(1) display:
last pid:  3242;  load averages:  0.05,  0.04,  0.00    up 0+05:43:03  17:53:11
24 processes:  1 running, 23 sleeping
CPU:  0.1% user,  0.0% nice,  0.0% system,  0.1% interrupt, 99.7% idle
Mem: 16M Active, 128M Inact, 151M Wired, 112M Buf, 1193M Free
Swap: 288M Total, 288M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
  798 root        1  20    0 10060K  1792K nanslp  2   0:05  0.00% cron
  861 root        1  20    0 17292K  5652K select  1   0:02  0.00% sshd
  791 root        1  20    0 12812K  4272K select  1   0:01  0.00% sendmail
  864 root        1  20    0 11772K  3648K pause   1   0:00  0.00% csh
 3169 root        1  20    0 17292K  5556K select  1   0:00  0.00% sshd
  854 root        1  52    0 10020K  1632K ttyin   0   0:00  0.00% getty
  856 root        1  52    0 10020K  1632K ttyin   2   0:00  0.00% getty
  690 root        1  20    0 10032K  1708K select  2   0:00  0.00% syslogd
 3172 root        1  32    0 11772K  3372K pause   1   0:00  0.00% csh
 3187 root        1  20    0 10112K  1820K select  2   0:00  0.00% inetd
  147 root        1  52    0  9912K  1448K pause   0   0:00  0.00% adjkerntz
  794 smmsp       1  20    0 12812K  4284K pause   2   0:00  0.00% sendmail
 3242 root        1  20    0 11168K  2264K CPU1    2   0:00  0.00% top
  788 root        1  20    0 14528K  4980K select  2   0:00  0.00% sshd
  858 root        1  52    0 10020K  1632K ttyin   2   0:00  0.00% getty
[... the list of processes goes on...]

Fix: The attached patch expands the 'u' function in the interactive display so the user can select processes owned by all users but one. The minus character is used to select the excluded user.

Example display for all processes not owned by root:
last pid:  3242;  load averages:  0.02,  0.03,  0.00    up 0+05:43:55  17:54:03
24 processes:  1 running, 23 sleeping
CPU:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Mem: 16M Active, 128M Inact, 151M Wired, 112M Buf, 1193M Free
Swap: 288M Total, 288M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
  794 smmsp       1  20    0 12812K  4284K pause   2   0:00  0.00% sendmail
  566 _dhcp       1  20    0 10136K  1848K select  2   0:00  0.00% dhclient

Top's display now is short, it fits in only a few rows.


Patch attached with submission follows:
How-To-Repeat: n/a
Comment 1 Rui Paulo freebsd_committer 2012-12-21 01:04:36 UTC
Responsible Changed
From-To: freebsd-bugs->rpaulo

Take ownership.