Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Mar 2017 23:22:00 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Dirk-Willem van Gulik <dirkx@webweaving.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: kill -0 <pid> --- side effect or supported
Message-ID:  <20170303222159.GA24794@dft-labs.eu>
In-Reply-To: <23F3BAC3-0D8B-4290-8DC2-818D67A0B6A9@webweaving.org>
References:  <23F3BAC3-0D8B-4290-8DC2-818D67A0B6A9@webweaving.org>

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

On Fri, Mar 03, 2017 at 11:12:26PM +0100, Dirk-Willem van Gulik 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(
> 

The signal 0 is mostly used to check if you can deliver signals in the
first place.

The problem with 'is alive?' checks with this mechanism is that zombies
eat up any signal sent, including 0.

For a shell script this may be good enough, but chances are you want to
invest into something which actually tracks children as opposed to just
dropping pidfiles.

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170303222159.GA24794>