Re: Communicating from a KEXT to a userland process
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com 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. That said, here is an example of the daemon calling the kext back: :) The userspace side is in udmarket/ResourceFileRelay/ResourceFileRelay.mm. Thanks, {P^/ _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... ... 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. 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). 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. Bruce Fancher This email sent to site_archiver@lists.apple.com
participants (1)
-
John Dalgliesh