From owner-svn-src-head@FreeBSD.ORG Sun Nov 10 05:22:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B33D1754; Sun, 10 Nov 2013 05:22:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9CF7A26C6; Sun, 10 Nov 2013 05:22:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAA5MTFh009250; Sun, 10 Nov 2013 05:22:29 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAA5MTsf009249; Sun, 10 Nov 2013 05:22:29 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201311100522.rAA5MTsf009249@svn.freebsd.org> From: Eitan Adler Date: Sun, 10 Nov 2013 05:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257911 - head/bin/pkill X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2013 05:22:29 -0000 Author: eadler Date: Sun Nov 10 05:22:29 2013 New Revision: 257911 URL: http://svnweb.freebsd.org/changeset/base/257911 Log: pkill - Optimize pgrep -F Ask for a specific process instead of pulling down all processes when -F is specified. This is much much faster. Obtained from: DragonflyBSD Modified: head/bin/pkill/pkill.c Modified: head/bin/pkill/pkill.c ============================================================================== --- head/bin/pkill/pkill.c Sun Nov 10 04:22:40 2013 (r257910) +++ head/bin/pkill/pkill.c Sun Nov 10 05:22:29 2013 (r257911) @@ -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));