View | Details | Raw Unified | Return to bug 173973
Collapse All | Expand All

(-)contrib/top/machine.h (+1 lines)
Lines 65-70 Link Here
65
    int system;		/* show system processes */
65
    int system;		/* show system processes */
66
    int thread;		/* show threads */
66
    int thread;		/* show threads */
67
    int uid;		/* only this uid (unless uid == -1) */
67
    int uid;		/* only this uid (unless uid == -1) */
68
    int buid;		/* all but this uid (unless buid == -1) */
68
    int wcpu;		/* show weighted cpu */
69
    int wcpu;		/* show weighted cpu */
69
    int jail;		/* show jail ID */
70
    int jail;		/* show jail ID */
70
    int kidle;		/* show per-CPU idle threads */
71
    int kidle;		/* show per-CPU idle threads */
(-)contrib/top/top.X (-2 / +4 lines)
Lines 286-293 Link Here
286
.TP
286
.TP
287
.B u
287
.B u
288
Display only processes owned by a specific username (prompt for username).
288
Display only processes owned by a specific username (prompt for username).
289
If the username specified is simply \*(lq+\*(rq, then processes belonging
289
If the username specified is simply \*(lq+\*(rq or \*(lq-\*(rq, then processes
290
to all users will be displayed.
290
belonging to all users will be displayed.
291
If the username is prefixed by a \*(lq-\*(rq, then only processes not owned
292
by the username will be displayed.
291
.TP
293
.TP
292
.B o
294
.B o
293
Change the order in which the display is sorted.  This command is not
295
Change the order in which the display is sorted.  This command is not
(-)contrib/top/top.c (-4 / +17 lines)
Lines 259-264 Link Here
259
    ps.self    = -1;
259
    ps.self    = -1;
260
    ps.system  = No;
260
    ps.system  = No;
261
    ps.uid     = -1;
261
    ps.uid     = -1;
262
    ps.buid    = -1;
262
    ps.thread  = No;
263
    ps.thread  = No;
263
    ps.wcpu    = 1;
264
    ps.wcpu    = 1;
264
    ps.jail    = No;
265
    ps.jail    = No;
Lines 997-1016 Link Here
997
				    "Username to show: ");
998
				    "Username to show: ");
998
				if (readline(tempbuf2, sizeof(tempbuf2), No) > 0)
999
				if (readline(tempbuf2, sizeof(tempbuf2), No) > 0)
999
				{
1000
				{
1000
				    if (tempbuf2[0] == '+' &&
1001
				    if ((tempbuf2[0] == '+' || tempbuf2[0] == '-') &&
1001
					tempbuf2[1] == '\0')
1002
					tempbuf2[1] == '\0')
1002
				    {
1003
				    {
1003
					ps.uid = -1;
1004
					ps.uid = -1;
1005
					ps.buid = -1;
1004
				    }
1006
				    }
1007
				    else if (tempbuf2[0] == '-')
1008
				    {
1009
					if ((i = userid(tempbuf2 + 1)) == -1)
1010
					{
1011
					    new_message(MT_standout,
1012
						" %s: unknown user", tempbuf2 + 1);
1013
					    no_command = Yes;
1014
					} else {
1015
					    ps.uid = -1;
1016
					    ps.buid = i;
1017
					}
1018
				    }
1005
				    else if ((i = userid(tempbuf2)) == -1)
1019
				    else if ((i = userid(tempbuf2)) == -1)
1006
				    {
1020
				    {
1007
					new_message(MT_standout,
1021
					new_message(MT_standout,
1008
					    " %s: unknown user", tempbuf2);
1022
					    " %s: unknown user", tempbuf2);
1009
					no_command = Yes;
1023
					no_command = Yes;
1010
				    }
1024
				    } else {
1011
				    else
1012
				    {
1013
					ps.uid = i;
1025
					ps.uid = i;
1026
					ps.buid = -1;
1014
				    }
1027
				    }
1015
				    putchar('\r');
1028
				    putchar('\r');
1016
				}
1029
				}
(-)usr.bin/top/machine.c (+6 lines)
Lines 671-676 Link Here
671
	int show_self;
671
	int show_self;
672
	int show_system;
672
	int show_system;
673
	int show_uid;
673
	int show_uid;
674
	int show_buid;
674
	int show_command;
675
	int show_command;
675
	int show_kidle;
676
	int show_kidle;
676
677
Lines 713-718 Link Here
713
	show_self = sel->self == -1;
714
	show_self = sel->self == -1;
714
	show_system = sel->system;
715
	show_system = sel->system;
715
	show_uid = sel->uid != -1;
716
	show_uid = sel->uid != -1;
717
	show_buid = sel->buid != -1;
716
	show_command = sel->command != NULL;
718
	show_command = sel->command != NULL;
717
	show_kidle = sel->kidle;
719
	show_kidle = sel->kidle;
718
720
Lines 768-773 Link Here
768
			/* skip proc. that don't belong to the selected UID */
770
			/* skip proc. that don't belong to the selected UID */
769
			continue;
771
			continue;
770
772
773
		if (show_buid && pp->ki_ruid == (uid_t)sel->buid)
774
			/* skip proc. that belong to the selected UID */
775
			continue;
776
771
		*prefp++ = pp;
777
		*prefp++ = pp;
772
		active_procs++;
778
		active_procs++;
773
	}
779
	}

Return to bug 173973