Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Mar 2017 14:23:37 -0800
From:      "Ngie Cooper (yaneurabeya)" <yaneurabeya@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:  <11A4B6AB-E51D-4754-8E80-4503687E0F84@gmail.com>
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

--Apple-Mail=_B6209A18-6EFA-43A5-9E7A-668EBE964B54
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Mar 3, 2017, at 14:12, Dirk-Willem van Gulik <dirkx@webweaving.org> =
wrote:
>=20
> 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.
>=20
> 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 :)=E2=80=A6

It does work as you noted, according to truss:

# sudo truss -ff kill -0 1 2>&1
...
79940: kill(1,0)                                 =3D 0 (0x0)
=E2=80=A6
#

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
     performed but no signal is actually sent.  This can be used to =
check the
     validity of pid.

So, the manpage for kill(1) is just lacking in the sense that -0 is =
supported.

Cheers!
-Ngie

--Apple-Mail=_B6209A18-6EFA-43A5-9E7A-668EBE964B54
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJYuezpAAoJEPWDqSZpMIYVy1QP/i03Kw+09Ofra9eOH/kjjFd8
IvSTEvV8AQDYRTpqSWFw+IX0zRKe7U6kh/eBJohRZz9s/V9oA2E7WVI7rpW20Coo
F/ft3Pot+5svUcr55i0kX0qVzbo2Gx/Jyna0oU5t/jmNNhWCfew/oYAZtZI/2/+O
vSancpX5oFHa6I934mFjb1a9e0w9iiTTFp29xEMmsKZbkU1vNC5pLZY5tQuyI64k
x0zT4JhDSPIUL1Ab62AJJWCVdtB4ZUgCFu2BqftLFzl5NEnh5u0luFteKTqzsYZX
VSp+teCs2CzXAdBdWiQUQtvp4bqja5TerUdq6CfMmt3Z4HyWQ7aW0M4mmkCLAWfn
bGPNtdo+yqmE9apNZDVoPbU+H8jCcHhjeogdSBqDFPL4j4lRYC9QWfIEwb2DrYGw
OTL6mRnbJYE6Gh9gRlREpyMRMCH+fk8YkKkmx6gYAY07FFwC/wATl8JU1i0FdSit
yBh14HApI0GhUXnXyZWadPYKa/KvuUviMV5Ot/DNCxIa+Vx5qJ6agAQRtQBdPF9n
kAw4qCInQyVfoyq3BbbZpZUOOnNLazdJzv9AqF8yKvDMmv0+SmMXie43e16ia1hI
bDUDU2h1u50qOTj9D3kRNZITfM6r0fTo8qnvXLsHUg37DZadBMSE1aK8GpNLj8wU
XbYjgKp8uAy28GpyKb+/
=AyPk
-----END PGP SIGNATURE-----

--Apple-Mail=_B6209A18-6EFA-43A5-9E7A-668EBE964B54--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11A4B6AB-E51D-4754-8E80-4503687E0F84>