简体   繁体   中英

Publishing information from IOKit KEXT on OS X

I have an IOKit-based kernel extension on Mac OS X, a subclass of IOService. When this service loads i need to publish additional specific runtime information from it and i need it to be accessible from user space without making some specific IOUserClient requests. The information in question is basically field\\value pairs and it's format is shared between the KEXT and it's user-space wrapper library. The contents will change over time on some specific events inside the service when it is active.

On Linux i would have accomplished this with a file in the /proc file system. Can you advise a similar strategy on OS X? Maybe something related to IORegistry?

Thank you.

Well this turned out to be pretty easy. Your IOKit service is (eventially) inherited from IOService class, which in turn is inherited from IORegistryEntry, which represents an instance of your service's entry in IORegistry and provides a family of setProperty\\getProperty methods to add\\change\\remove your own fields in IORegistry entry for your service.

The IORegistry in an in-memory database that is of course programmatically accessible from user space where you search it for you service's entry and read information published by it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM