Launch on demand from kernel extension?
Hello, I have an OS X kernel extension that has settings that need to be saved and restored (the settings are not per-user). Since a kernel extension cannot read/write a preference file, I have a helper daemon that interfaces with my kext and handles the reading/writing of the preference file. I have recently converted over from using StartupItems to using launchd to launch my helper daemon at startup. Is it possible, using launchd, to have my kernel extension launch the helper daemon on demand? If so, what is the best way to implement this? I need to support OS X 10.4.11 and above. cheers, colin
At 13:28 -0700 23/6/08, Colin wrote:
Is it possible, using launchd, to have my kernel extension launch the helper daemon on demand? If so, what is the best way to implement this? I need to support OS X 10.4.11 and above.
This isn't any explicit support for this within Mac OS X. We're hoping to support this more explicitly in the future, at least for I/O Kit KEXTs <rdar://problem/4551362> <rdar://problem/4193561>, but there's nothing in place right now. One option is to have your daemon start on demand based on a connection to UNIX domain socket and then have your KEXT connect to that socket when it needs service. I've been working on a sample that shows this. I'll send you a copy via personal email. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
On 24-Jun-08, at 13:04 , Quinn wrote:
At 13:28 -0700 23/6/08, Colin wrote:
Is it possible, using launchd, to have my kernel extension launch the helper daemon on demand? If so, what is the best way to implement this? I need to support OS X 10.4.11 and above.
This isn't any explicit support for this within Mac OS X. We're hoping to support this more explicitly in the future, at least for I/O Kit KEXTs <rdar://problem/4551362> <rdar://problem/4193561>, but there's nothing in place right now.
One option is to have your daemon start on demand based on a connection to UNIX domain socket and then have your KEXT connect to that socket when it needs service. I've been working on a sample that shows this. I'll send you a copy via personal email.
Would the mechanism be similar for stuff wanting to establish tunnels? I ask because I had previously looked at trying to make tun/tap use launchd or something similar, instead of a startup item, but I didn't find anything appropriate. Andre
At 16:30 -0400 24/6/08, Andre-John Mas wrote:
Would the mechanism be similar for stuff wanting to establish tunnels?
Not really. My code is useful in situation where the KEXT is loaded automatically (that is, an I/O Kit KEXT) but needs some assistance from a user space process. A tunnel KEXT is never loaded automatically, and thus there's some process within the system that's doing that loading. It would make more sense for the existing process to coordinate with other user space processes that need the tunnel driver. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
participants (3)
-
Andre-John Mas
-
Colin
-
Quinn