diff -r -u procps-3.2.7-orig/top.1 procps-3.2.7/top.1 --- procps-3.2.7-orig/top.1 2006-06-19 05:33:51.000000000 +0100 +++ procps-3.2.7/top.1 2008-11-22 07:38:29.000000000 +0000 @@ -260,6 +260,16 @@ When this toggle is \*F, tasks that are idled or zombied will not be displayed. .TP 5 +\-\fBj\fR :\fB Monitor excluding user\fR as:\fB\ \ -u somebody +Monitor only processes with an effective UID or user name +not matching that given. + +.TP 5 +\-\fBJ\fR :\fB Monitor excluding user\fR as:\fB\ \ -U somebody +Monitor only processes with a UID or user name not matching that given. +This matches real, effective, saved, and filesystem UIDs. + +.TP 5 \-\fBn\fR :\fB Number of iterations\fR limit as:\fB\ \ -n number\fR Specifies the maximum number of iterations, or frames, \*(Me should produce before ending. @@ -644,6 +654,18 @@ After issuing this command, you'll be informed of the new state of this toggle. .TP 7 +\ \ \'\fBj\fR\' :\fIexclude a user\fR +You will be prompted for a UID or username. Processes not +belonging to the selected user will be displayed. This option +matches on the effective UID. + +.TP 7 +\ \ \'\fBJ\fR\' :\fIexclude a user\fR +You will be prompted for a UID or username. Processes not +belonging to the selected user will be displayed. This option +matches on the real, effective, saved, and filesystem UID. + +.TP 7 \ \ \'\fBu\fR\' :\fIselect a user\fR You will be prompted for a UID or username. Only processes belonging to the selected user will be displayed. This option diff -r -u procps-3.2.7-orig/top.c procps-3.2.7/top.c --- procps-3.2.7-orig/top.c 2006-06-25 07:41:48.000000000 +0100 +++ procps-3.2.7/top.c 2008-11-22 07:33:00.000000000 +0000 @@ -841,6 +841,18 @@ return 1; case 0: return 1; + case 'J': + // Do not fall through because this conflicts with u/U + if ( pp->ruid != selection_uid + && + pp->suid != selection_uid + && + pp->fuid != selection_uid ) { return 1; } + else { return 0; }; + case 'j': + // Do not fall through because this conflicts with u/U + if (pp->euid != selection_uid) { return 1; } + else { return 0; }; case 'U': if (pp->ruid == selection_uid) return 1; if (pp->suid == selection_uid) return 1; @@ -1803,7 +1815,7 @@ . bunched args are actually handled properly and none are ignored . we tolerate NO whitespace and NO switches -- maybe too tolerant? */ static const char usage[] = - " -hv | -bcisSH -d delay -n iterations [-u user | -U user] -p pid [,pid ...]"; + " -hv | -bcisSH -d delay -n iterations [-u user | -U user | -j user | -J user] -p pid [,pid ...]"; float tmp_delay = MAXFLOAT; char *p; @@ -1839,6 +1851,32 @@ TOGw(Curwin, Show_IDLEPS); Curwin->rc.maxtasks = 0; break; + case 'j': + do { + const char *errmsg; + if (selection_type /* && selection_type != 'j' */) std_err("conflicting process selection"); + if (cp[1]) cp++; + else if (*args) cp = *args++; + else std_err("-j missing name"); + errmsg = parse_uid(cp, &selection_uid); + if (errmsg) std_err(errmsg); + selection_type = 'j'; + cp += snprintf(Curwin->colusrnam, USRNAMSIZ-1, "%s", cp); // FIXME: junk + } while(0); + break; + case 'J': + do { + const char *errmsg; + if (selection_type /* && selection_type != 'J' */) std_err("conflicting process selection"); + if (cp[1]) cp++; + else if (*args) cp = *args++; + else std_err("-J missing name"); + errmsg = parse_uid(cp, &selection_uid); + if (errmsg) std_err(errmsg); + selection_type = 'J'; + cp += snprintf(Curwin->colusrnam, USRNAMSIZ-1, "%s", cp); // FIXME: junk + } while(0); + break; case 'n': if (cp[1]) cp++; else if (*args) cp = *args++; @@ -2167,7 +2205,9 @@ } } - if (selection_type=='U') Frames_libflags |= L_status; + if (selection_type=='U' + || + selection_type=='J') Frames_libflags |= L_status; if (Frames_libflags & L_EITHER) { Frames_libflags &= ~L_EITHER; @@ -2627,6 +2667,50 @@ } break; + case 'j': +// if (!VIZCHKc) break; + do { + const char *errmsg; + const char *answer; + answer = ask4str("Exclude which user (blank for none)"); + // FIXME: do this better: + if (!answer || *answer=='\0' || *answer=='\n' || *answer=='\r' || *answer=='\t' || *answer==' ') { + selection_type = 0; + selection_uid = -1; + break; + } + errmsg = parse_uid(answer, &selection_uid); + if (errmsg) { + show_msg(errmsg); + // Change settings here? I guess not. + break; + } + selection_type = 'j'; + } while(0); + break; + + case 'J': +// if (!VIZCHKc) break; + do { + const char *errmsg; + const char *answer; + answer = ask4str("Exclude which user (blank for none)"); + // FIXME: do this better: + if (!answer || *answer=='\0' || *answer=='\n' || *answer=='\r' || *answer=='\t' || *answer==' ') { + selection_type = 0; + selection_uid = -1; + break; + } + errmsg = parse_uid(answer, &selection_uid); + if (errmsg) { + show_msg(errmsg); + // Change settings here? I guess not. + break; + } + selection_type = 'J'; + } while(0); + break; + case 'k': if (Secure_mode) { show_msg(err_secure);