Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Mar 2017 14:42:40 -0800
From:      "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To:        "Rodney W. Grimes" <freebsd-rwg@pdx.rh.CN85.dnsmgr.net>
Cc:        Dirk-Willem van Gulik <dirkx@webweaving.org>, freebsd-hackers@freebsd.org
Subject:   Re: kill -0 <pid> --- side effect or supported
Message-ID:  <35C6F2AA-309E-4D58-8191-AB99F0195BEC@gmail.com>
In-Reply-To: <201703032230.v23MUg5b072955@pdx.rh.CN85.dnsmgr.net>
References:  <201703032230.v23MUg5b072955@pdx.rh.CN85.dnsmgr.net>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

> On Mar 3, 2017, at 14:30, Rodney W. Grimes <freebsd-rwg@pdx.rh.CN85.dnsmgr.net> wrote:
> 
> -- Start of PGP signed section.
> [ Charset UTF-8 unsupported, converting... ]
>> 
>>> On Mar 3, 2017, at 14:12, Dirk-Willem van Gulik <dirkx@webweaving.org> wrote:
>>> 
>>> I regularly use  'kill -0 <pid>' 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.

It might be a good idea to clarify this point/behavior by pointing to kill(2) for the signal behavior/description noted above.

Thanks,
-Ngie

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJYufFgAAoJEPWDqSZpMIYVfL0QAMIt8yKXvrChGbPR/LeWkPhf
n4p8+JLgcFyoDNIpr/LEUHAdCK8NWxAwY+ZmHaP95zs5txGpde1hU4QUnXsxoNu7
c8z57PESnczQBViHQhCgL7XDVodV7GWdL4Xm/0mNgFE5BsDYia0+0XbLl0Kj93yI
/drwWGvEygnwYa6uZpDugJaP546Ng/d4izYY3HnvVWMRsi4WphNZs7SYfbPOMUdP
an7CxvcXe/YGKd0sZVHq7Pkej1W/nWEFZJHCQ+AbrriwaHkCNpCBYJrYdsYCtrce
P9ssIEj75f2tpn1O/Ybf5f8HwcBDFxG/zXnxI+/M5ZH1XlVSmSM3hO3gPNK9/PAO
xjLMmOrrVlxCbKxnDiIiWhPQBSNpwzYgWUi6zDqrIOdhKc7z8NCykQUqrdfwQozm
dLgtq9y1vTmSPeIYcdR1J1MD3y71l0/BaqJeBpNwgJa6fu3H2RUAwnlF0LGY2J0A
FAErVi6allBejHKx+MEXBzerFO9PI8GLH/st8fX1BlrSRqsSe0BHz6x38TO8RXUK
utnyFEKCLkzwUMp1Nfng+jAZheNKSoSPisX5TLPUsE7lDypmaVbY8inlVGH3/Q76
qOK2HJMhO3RXGBQhDiQUitbYkl4azuUCkObICTVR6b/OtrFtGnrSExS7dNErvv2S
0KCuaAuIM6H1etOW880J
=YB3I
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35C6F2AA-309E-4D58-8191-AB99F0195BEC>