From owner-freebsd-threads@FreeBSD.ORG Mon Jun 21 14:36:08 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A3C816A4CE for ; Mon, 21 Jun 2004 14:36:08 +0000 (GMT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id E073943D5A for ; Mon, 21 Jun 2004 14:36:07 +0000 (GMT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i5LEa4j0029368; Mon, 21 Jun 2004 10:36:06 -0400 (EDT) Date: Mon, 21 Jun 2004 10:36:04 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Sean McNeil In-Reply-To: <1087794678.46146.4.camel@server.mcneil.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org Subject: Re: kill(pid,0) sends a signal or not? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2004 14:36:08 -0000 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? -- Dan Eischen