Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bsd sockets in a kext



Stephane --

So I suppose that my C++ object (actually the code of my kext) containing
the start() function must have a really unique name which will be used by
the user level daemon to identify it with IOServiceAddMatchingNotification()

You should have the really unique name ANYWAY. The reason you need a unique name is to prevent namespace collisions in the kernel. For example, say you ship a driver whose class name is MyUSBKeyboardDriver. If anyone else tries to name their driver MyUSBKeyboardDriver, your names will clash and one of you will not be loaded into the kernel. Apple recommends using the reverse DNS approach to prevent namespace collisions (similar to the Java approach). Something like net_odul_driver_stephane_keyboard for your class name ( and net.odul.driver.stephane.keyboard for your CFBundleIdentifier ) is much less likely to be chosen by anyone else :). This is all covered in the IOKit Fundamentals book (a MUST read for anyone doing KEXT development!).

The comments explain that the function register to get notifications. After
that we have a bunch of descriptions of the parameters. I did not figured
out what refcon was for. (seems NULL is a good value for it).

Refcon is any arbitrary context you want passed back to you when the notification arrives on your runloop. It can be a pointer to a struct (which was created with malloc, not something on the stack!), a number, some other cookie. Of course, it can also be NULL if you don't have a context for the callback.

Hope that helps.

-- Chris

------------------
6 Infinite Loop
M/S 306-2MS
Cupertino CA 95014
phone: (408) 974-4033
fax: (408) 862-7577
email: email@hidden
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Bsd sockets in a kext (From: Stephane ODUL <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.