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
This commit is contained in:
parent
a36032c3d7
commit
03eea902e7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257911
@ -318,7 +318,10 @@ main(int argc, char **argv)
|
|||||||
* Use KERN_PROC_PROC instead of KERN_PROC_ALL, since we
|
* Use KERN_PROC_PROC instead of KERN_PROC_ALL, since we
|
||||||
* just want processes and not individual kernel threads.
|
* 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) {
|
if (plist == NULL) {
|
||||||
errx(STATUS_ERROR, "Cannot get process list (%s)",
|
errx(STATUS_ERROR, "Cannot get process list (%s)",
|
||||||
kvm_geterr(kd));
|
kvm_geterr(kd));
|
||||||
|
Loading…
Reference in New Issue
Block a user