Date: Fri, 18 Mar 2005 14:22:33 +0000 (GMT) From: Robert Watson <rwatson@FreeBSD.org> To: John-Mark Gurney <gurney_j@resnet.uoregon.edu> Cc: freebsd-hackers@freebsd.org Subject: Re: How to send a signal from inside the kernel? Message-ID: <Pine.NEB.3.96L.1050318142023.87456J-100000@fledge.watson.org> In-Reply-To: <20050317181200.GK89312@funkthat.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1050318142023.87456J-100000>