RE: Communicating from a KEXT to a userland process
RE: Communicating from a KEXT to a userland process
- Subject: RE: Communicating from a KEXT to a userland process
- From: "Bruce Fancher" <email@hidden>
- Date: Sun, 28 May 2006 15:40:20 -0400
Thanks. I'll check this out.
Bruce
-----Original Message-----
From: John Dalgliesh [mailto:email@hidden]
Sent: Sunday, May 28, 2006 12:29 PM
To: Bruce Fancher
Cc: email@hidden
Subject: Re: Communicating from a KEXT to a userland process
Hi Bruce,
On Sun, 28 May 2006, Bruce Fancher wrote:
...
>
> The problem I'm having is figuring out how to communicate back out
> from my Kext to userland. TN2127 uses the example of an anti-virus
> program, which is conceptually similar to what I'm trying to do, and
> specifically suggests having the Kext pass a request to a user space
> daemon. However it doesn't provide any suggestion or example wrt
> exactly how I might go about communicating from the Kext to said daemon.
>
...
>
> Oh, and I also tried looking into using Mach ports, but again I
> couldn't find any examples or documentation.
>
> So, first of all what mechanism should I be using, and second, how do
> I use I use it? Any example code anyone can provide would be very
welcome.
I believe that the general rule is: if you can form your daemon<->kext
relationship in such a way that the daemon makes blocking calls into the
kext, and the kext repsonds to them when it has something to send, then you
should do this as you will be a much happier person and lead a long and
fulfilling life.
Or if you just want to send small messages (<64 bytes) then the argument of
IOService::message does propagate nicely to userspace via an
IONotificationPort.
That said, here is an example of the daemon calling the kext back:
:)
When I encountered this situation the Mach ports route looked promising to
me, and after much perseverence I managed to get it to work. You can find a
working example in the file Drivers/UDMUtils/UDMResourceFile.cpp in the CVS
repository on this page: <http://www.defyne.org/dvb/> (under the
'Development' section).
The userspace side is in udmarket/ResourceFileRelay/ResourceFileRelay.mm.
This code is a kext+daemon that allows you to read (and write) files from
the kernel, for loading firmware or config files, etc. Some of the details
are probably not very kosher although I believe the design (now) is, so
YMMV.
> Thanks,
>
> Bruce Fancher
{P^/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden