Skip zombies. Add an option (-z) to revert to the historical behaviour
of trying to kill zombies (which has no effect except emit a few error messages)
This commit is contained in:
parent
e479b601dd
commit
a2fefc8d1d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=94689
@ -38,6 +38,7 @@
|
||||
.Op Fl l
|
||||
.Op Fl m
|
||||
.Op Fl s
|
||||
.Op Fl z
|
||||
.Op Fl u Ar user
|
||||
.Op Fl t Ar tty
|
||||
.Op Fl c Ar procname
|
||||
@ -103,6 +104,10 @@ or
|
||||
flags, limit potentially matching processes to those matching
|
||||
the specified
|
||||
.Ar progname .
|
||||
.It Fl z
|
||||
Don't skip zombies.
|
||||
This should not have any effect except to print a few error messages
|
||||
if there are zombie processes that match the specified pattern.
|
||||
.El
|
||||
.Sh ALL PROCESSES
|
||||
Sending a signal to all processes with uid
|
||||
|
@ -113,6 +113,7 @@ main(int ac, char **av)
|
||||
int sflag = 0;
|
||||
int dflag = 0;
|
||||
int mflag = 0;
|
||||
int zflag = 0;
|
||||
uid_t uid = 0;
|
||||
dev_t tdev = 0;
|
||||
char thiscmd[MAXCOMLEN + 1];
|
||||
@ -177,6 +178,9 @@ main(int ac, char **av)
|
||||
case 'm':
|
||||
mflag++;
|
||||
break;
|
||||
case 'z':
|
||||
zflag++;
|
||||
break;
|
||||
default:
|
||||
if (isalpha(**av)) {
|
||||
if (strncasecmp(*av, "sig", 3) == 0)
|
||||
@ -286,6 +290,8 @@ main(int ac, char **av)
|
||||
printf("nprocs %d\n", nprocs);
|
||||
|
||||
for (i = 0; i < nprocs; i++) {
|
||||
if ((procs[i].ki_stat & SZOMB) == SZOMB && !zflag)
|
||||
continue;
|
||||
thispid = procs[i].ki_pid;
|
||||
strncpy(thiscmd, procs[i].ki_comm, MAXCOMLEN);
|
||||
thiscmd[MAXCOMLEN] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user