diff options
author | des <des@FreeBSD.org> | 2002-04-14 22:25:57 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-04-14 22:25:57 +0000 |
commit | 61ee47c9bff890b047abda80aed0dc6f4e546e64 (patch) | |
tree | 7836123fe010e6b3c5ded3f7d2ceefc555168363 /usr.bin/killall | |
parent | 06b809501b152a7f2bf3d9ad135051c200f36375 (diff) | |
download | FreeBSD-src-61ee47c9bff890b047abda80aed0dc6f4e546e64.zip FreeBSD-src-61ee47c9bff890b047abda80aed0dc6f4e546e64.tar.gz |
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)
Diffstat (limited to 'usr.bin/killall')
-rw-r--r-- | usr.bin/killall/killall.1 | 5 | ||||
-rw-r--r-- | usr.bin/killall/killall.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/usr.bin/killall/killall.1 b/usr.bin/killall/killall.1 index df3de49..2771bbe 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 7be6bc6..e06d91e 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'; |