From owner-freebsd-hackers@freebsd.org Sat Mar 4 00:55:44 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81284CF5ED3 for ; Sat, 4 Mar 2017 00:55:44 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2AF3F1595 for ; Sat, 4 Mar 2017 00:55:43 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v240tfVu073570; Fri, 3 Mar 2017 16:55:41 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v240tf0H073569; Fri, 3 Mar 2017 16:55:41 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201703040055.v240tf0H073569@pdx.rh.CN85.dnsmgr.net> Subject: Re: kill -0 --- side effect or supported In-Reply-To: <35C6F2AA-309E-4D58-8191-AB99F0195BEC@gmail.com> To: "Ngie Cooper (yaneurabeya)" Date: Fri, 3 Mar 2017 16:55:41 -0800 (PST) CC: Dirk-Willem van Gulik , freebsd-hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Mailman-Approved-At: Sat, 04 Mar 2017 01:57:50 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Mar 2017 00:55:44 -0000 > > > On Mar 3, 2017, at 14:30, Rodney W. Grimes wrote: > > > > -- Start of PGP signed section. > > [ Charset UTF-8 unsupported, converting... ] > >> > >>> On Mar 3, 2017, at 14:12, Dirk-Willem van Gulik wrote: > >>> > >>> I regularly use 'kill -0 ' on FreeBSD as a way to test if a certain process is still running (but without actually sending the signal). And I think it has worked reliably since the mid 80's. > >>> > >>> Is it actually a properly supported use - as I recently happened to notice that it does not seem to be all that documented in kill( > >> > >> It better work. I have code that relies on it :)? > >> > >> It does work as you noted, according to truss: > >> > >> # sudo truss -ff kill -0 1 2>&1 > >> ... > >> 79940: kill(1,0) = 0 (0x0) > >> ? > >> # > >> > >> As noted in kill(2), this is one of the valid values: > >> > >> a group of processes. The sig argument may be one of the signals > >> specified in sigaction(2) or it may be 0, in which case error checking is > > ^^^^^^^^^^^^^^^^ > > > > That bit of information should be promoted from kill(2) to kill(1) by > > adding 0 to the list as ?. > > Actually? it is mentioned in kill(1) ? you just have to read between the lines: > > -signal_number > A non-negative decimal integer, specifying the signal to be sent > instead of the default TERM. > > 0 is technically a non-negative real number. yes, but make it explicity clear just like it is explicity clear in kill(2), documentation should be good, clear and concise, not left for guessing between the lines. Add a 0 item to the list of popular signals, or add a sentence about this special case that is not well known. > It might be a good idea to clarify this point/behavior by pointing to kill(2) for the signal behavior/description noted above. It already has a xref to kill(2). Compters derefence pointers better than people do, so we can use all the help we can get, and if we are reading a man page we need help! -- Rod Grimes rgrimes@freebsd.org