Date: Mon, 21 Jun 2004 12:20:26 -0700 From: Sean McNeil <sean@mcneil.com> To: Daniel Eischen <eischen@vigrid.com> Cc: freebsd-threads@freebsd.org Subject: Re: kill(pid,0) sends a signal or not? Message-ID: <1087845626.85957.1.camel@server.mcneil.com> In-Reply-To: <Pine.GSO.4.10.10406211032360.28158-100000@pcnet5.pcnet.com> References: <Pine.GSO.4.10.10406211032360.28158-100000@pcnet5.pcnet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2004-06-21 at 07:36, Daniel Eischen wrote: > On Sun, 20 Jun 2004, Sean McNeil wrote: > > > I'm trying to trace down an issue with kse threads and firefox. There > > is an odd "trick" I haven't seen before: > > > > // kill(pid,0) is a neat trick to check if a > > // process exists > > if (kill(pid, 0) == 0 || errno != ESRCH) > > > > Does this really work? It is kind of odd that it I appear to get a > > signal (if the traceback is accurate) with the signal set to 0: > > > > #10 0x0000000202bc7a80 in thr_resume_wrapper (sig=0, siginfo=0x4, > > ucp=0x7fffffffd4c0) at /usr/src/lib/libpthread/thread/thr_kern.c:1112 > > > > This later causes a sig 11 and the program core dumps. > > > > Any info on how threads are suppose to behave when a process does a > > kill(pid,0) would be greatly appreciated. > > kill(pid, 0) shouldn't result in a signal. libpthread doesn't do > anything with kill() and the kernel shouldn't cause a signal for 0 > either. What does ktrace show? It wasn't generating a sig 0. What I was seeing was the inner workings of the threads where a "sig" variable was set to 0, but the actual signal was 11. Everything is working as designed as far as I can tell.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1087845626.85957.1.camel>