Kernel IPC

11 views
Skip to first unread message

me

unread,
Mar 6, 2012, 5:13:42 PM3/6/12
to darwin...@lists.apple.com
Can anyone give me a direction to pursue further inquiry? From reading Apple's documentation, as well as Singh and Halvorsen, I understand how to create a kernel extension and set variables from a user space application. My ultimate goal is to post KAUTH KAUTH_FILEOP_OPEN messages to a user space application/daemon. I am looking for some code examples of kext to user space code. Should I use Mach messages? Is that overkill? Is there an easier strategy? What about BSD sockets? I understand from  Halvorsen's book how a user space client can set up a mach port with a kext driver, but I really don't need to use a theI/O kit, so I could use some further pointers.

Thanks,

Trip 

Quinn "The Eskimo!"

unread,
Mar 7, 2012, 1:06:02 PM3/7/12
to darwin-kernel@lists.apple.com Kernel

On 6 Mar 2012, at 22:13, me wrote:

> I am looking for some code examples of kext to user space code.

For BSD level code I generally recommend kernel control sockets, as illustrated by the tcplognke sample code.

<https://developer.apple.com/library/mac/#samplecode/tcplognke/>

In my experience it's very hard to get Mach messaging right and, when you get it from from kernel code, you end up rebooting a lot )-:

Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (Darwin...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/darwin-kernel/darwin-kernel-garchive-95844%40googlegroups.com

This email sent to darwin-kernel-...@googlegroups.com

Kevin Brock

unread,
Mar 8, 2012, 12:50:24 PM3/8/12
to darwin-kernel@lists.apple.com Kernel
On Mar 7, 2012, at 10:06 AM, Quinn The Eskimo! wrote:

>
> On 6 Mar 2012, at 22:13, me wrote:
>
>> I am looking for some code examples of kext to user space code.
>
> For BSD level code I generally recommend kernel control sockets, as illustrated by the tcplognke sample code.
>
> <https://developer.apple.com/library/mac/#samplecode/tcplognke/>

I second this recommendation. I've used kernel control sockets for all sorts of things, and they're 1) brain dead simple compared to some alternatives and 2) pretty robust--I haven't had a major bug yet related to any of the kernel control socket functionality.

> In my experience it's very hard to get Mach messaging right and, when you get it from from kernel code, you end up rebooting a lot )-:

Or worse, your customer finds the corner cases and *they* reboot a lot…

Kevin

Reply all
Reply to author
Forward
0 new messages