diff --git a/usr.bin/killall/killall.1 b/usr.bin/killall/killall.1 index df3de49d687..2771bbe76d7 100644 --- a/usr.bin/killall/killall.1 +++ b/usr.bin/killall/killall.1 @@ -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 diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c index 7be6bc620ae..e06d91e2cea 100644 --- a/usr.bin/killall/killall.c +++ b/usr.bin/killall/killall.c @@ -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';