diff options
author | eadler <eadler@FreeBSD.org> | 2013-11-10 05:22:29 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2013-11-10 05:22:29 +0000 |
commit | 5f86fc4ba56fa5f454cc3eaa52de3933fa3f3ea7 (patch) | |
tree | 893088322b6e4064b207f193ecb448271e84e0cd /bin | |
parent | 9cb348964544612ee7fbc4ce2ecdb1b3209f4785 (diff) | |
download | FreeBSD-src-5f86fc4ba56fa5f454cc3eaa52de3933fa3f3ea7.zip FreeBSD-src-5f86fc4ba56fa5f454cc3eaa52de3933fa3f3ea7.tar.gz |
pkill - Optimize pgrep -F
Ask for a specific process instead of pulling down all processes when
-F <pidfile> is specified. This is much much faster.
Obtained from: DragonflyBSD
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pkill/pkill.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/pkill/pkill.c b/bin/pkill/pkill.c index add989f..e73f5f2 100644 --- a/bin/pkill/pkill.c +++ b/bin/pkill/pkill.c @@ -318,7 +318,10 @@ main(int argc, char **argv) * Use KERN_PROC_PROC instead of KERN_PROC_ALL, since we * just want processes and not individual kernel threads. */ - plist = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc); + if (pidfromfile >= 0) + plist = kvm_getprocs(kd, KERN_PROC_PID, pidfromfile, &nproc); + else + plist = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc); if (plist == NULL) { errx(STATUS_ERROR, "Cannot get process list (%s)", kvm_geterr(kd)); |