From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 4 10:26:32 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DA6B1065672 for ; Thu, 4 Feb 2010 10:26:32 +0000 (UTC) (envelope-from eitanadlerlist@gmail.com) Received: from mail-fx0-f224.google.com (mail-fx0-f224.google.com [209.85.220.224]) by mx1.freebsd.org (Postfix) with ESMTP id D78678FC0A for ; Thu, 4 Feb 2010 10:26:31 +0000 (UTC) Received: by fxm24 with SMTP id 24so570541fxm.3 for ; Thu, 04 Feb 2010 02:26:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=6D+lE9rXwDL37v6AcCs3DhRl8KmcAGrnsFlEFr+VdE0=; b=UNBnmdZwPI4wj4yp8WtP8AbbPKtmgCPVTXsiQR7ajU4Vsej36WBy5BYmiclAUqUsNs iKuHC5L+owkhGdNXZ27t/jQ67AKqKIf+yQVLNDn88q6V/xTdwArfb1MsVO6IO+B/iMcy xdU9UxBVQawm8vXvne9KrOXVMmn07Rvzkowkw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=EuOLeZn7BZOUyZro7D8Pfr8t881o1xkOe1Cw4TdlHSOqjPWoUNmstY+1lk4RBjZDV5 pZLny8UnltbNKK3rgLiH2hrulU/VjXXhAbHPeAV/UVAFG0YjKDJbOrOkot9sQorc0ADn xhHlnB/M4PqjSHH3u0o/WkmAxesplWfJescxA= MIME-Version: 1.0 Received: by 10.239.190.77 with SMTP id w13mr95006hbh.25.1265277706688; Thu, 04 Feb 2010 02:01:46 -0800 (PST) In-Reply-To: References: From: Eitan Adler Date: Thu, 4 Feb 2010 12:01:26 +0200 Message-ID: To: Jason Spiro Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: [RFC] [patch] pkill verbose option X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 10:26:32 -0000 This patch hijacks pgrep's -l Index: pkill.1 =================================================================== --- pkill.1 (revision 203347) +++ pkill.1 (working copy) @@ -168,9 +168,9 @@ If used in conjunction with .Fl f , print the process ID and the full argument list for each matching process. -This option can only be used with the -.Nm pgrep -command. +If used in conjunction with the +.Nm pkill +command, it lists the signal sent as well. .It Fl n Select only the newest (most recently started) of the matching processes. .It Fl o Index: pkill.c =================================================================== --- pkill.c (revision 203347) +++ pkill.c (working copy) @@ -182,7 +182,7 @@ pidfilelock = 0; execf = coref = _PATH_DEVNULL; - while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ij:lnos:t:u:vx")) != -1) + while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ilj:lnos:t:u:vx")) != -1) switch (ch) { case 'D': debug_opt++; @@ -245,8 +245,6 @@ criteria = 1; break; case 'l': - if (!pgrep) - usage(); longfmt = 1; break; case 'n': @@ -528,16 +526,26 @@ /* * Take the appropriate action for each matched process, if any. */ + int didAction = 0; for (i = 0, rv = 0, kp = plist; i < nproc; i++, kp++) { if (PSKIP(kp)) continue; if (selected[i]) { + if (longfmt) + { + didAction = 1; + printf("kill -%d %d\n",signum,kp->ki_pid); + } if (inverse) continue; } else if (!inverse) continue; rv |= (*action)(kp); } + if (!didAction && !pgrep) + { + printf("No matching processes belonging to you were found\n"); + } exit(rv ? STATUS_MATCH : STATUS_NOMATCH); } On Thu, Feb 4, 2010 at 11:24 AM, Jason Spiro wrote: > jhell DataIX.net> writes: > > [snip] > > > > Now pkill -v sleep on my system actually causes my Xserver to exit with a > > unexpected signal 15. > > Yes. "pkill -v sleep" kills all your own processes except for sleep. As > root, > it kills all processes running on your machine except for sleep. > > -V is not a good choice of letter for this option: it's too easy to write > -v > instead by accident. -l (dash-ell), as jhell has suggested elsewhere in > this > thread, would be ideal, since it's lowercase and easy to type. If you > don't > like -l, you could choose to make it -D (for "Debug") instead. > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >