From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 18 14:25:16 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6179D16A4CE for ; Fri, 18 Mar 2005 14:25:16 +0000 (GMT) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 27B7A43D1F for ; Fri, 18 Mar 2005 14:25:16 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with SMTP id D1B7B46B06; Fri, 18 Mar 2005 09:25:15 -0500 (EST) Date: Fri, 18 Mar 2005 14:22:33 +0000 (GMT) From: Robert Watson X-Sender: robert@fledge.watson.org To: John-Mark Gurney In-Reply-To: <20050317181200.GK89312@funkthat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Aziz KEZZOU cc: freebsd-hackers@freebsd.org Subject: Re: How to send a signal from inside the kernel? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2005 14:25:16 -0000 On Thu, 17 Mar 2005, John-Mark Gurney wrote: > > but that causes a page fault in kernel mode (ie. Kernel panic :-) > > > > Any help is appreciated, thanks. > > Take a look at psignal(9)... You'll need to look up the struct proc for > psignal with pfind(9)... and then PROC_UNLOCK the struct proc after > you've used psignal... Depending on the circumstances, it may also be appropriate to add an access control check in the form: error = p_cansignal(td, p); if (error) { PROC_UNLOCK(p); return (error); } Where 'td' is the requesting thread, and 'p' is the target process. Robert N M Watson > > so: > struct proc *p; > > p = pfind(pid); > if (p != NULL) { > psignal(p, SIGUSR1); > PROC_UNLOCK(p); > } > > I haven't tried the code above, but that should do what you want... > > -- > John-Mark Gurney Voice: +1 415 225 5579 > > "All that I will do, has been done, All that I have, has not." > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >