On Sunday, November 10, 2002, at 10:54 AM, chuck remes wrote: I'm trying to get my kext to successfully unload so I can test it without going through a reboot cycle. I'm having problems. After running kextload, my kext goes through its init() and start() sequences. I have engineered it so start() fails. When I run kextunload, I get this in system.log. : Can't unload com.chuck.iokit.tulip due to - : com.chuck.iokit.tulip: com_cremes_eeprom has 1 instance(s) : com.chuck.iokit.tulip: com_chuck_iokit_tulip has 1 instance(s) : com.chuck.iokit.tulip: com_cremes_eeprom_sio has 1 instance(s) : com.chuck.iokit.tulip: com_cremes_eeprom_sio_dec2114x has 1 instance(s) : com.chuck.iokit.tulip: com_chuck_iokit_tulip_dec2114x has 1 instance(s) : com.chuck.iokit.tulip: com_chuck_iokit_tulip_pnic2 has 1 instance(s) <snip> Okay, here's a little more information. I'm cross-posting this in darwin-kernel since it deals with some kernel internals. In the terminal window the command generates: [12-247-46-43:projects/tulip/build] cremes% sudo kextunload tulip.kext/ unload kext tulip.kext/ failed (result code 0xdc004002) I did a little digging in the sources for kextunload. It's successfully completing two of three loops to perform the unload and failing on the last loop. The first two loops unload the class names and then the bundle identifiers. The final loop tries to unload the actual kext module. It's calling IOCatalogueTerminate() which is returning the hex value printed above. Does anyone know what this kernel result means? I dug all the way into xnu sources. In IOCatalogue.cpp I traced the logic to the method IOCatalogue::unloadModule(). The method verifies there are ZERO references left on the module; if so, it calls the stop() function and unloads it from kernel memory. If there is any reference to the module, which in my case there is, it returns kIOReturnBadArgument (0x2c2). So now I understand why the stop() function isn't being called (there is still a reference) but I don't know where that reference is coming from! I'm probably missing something obvious here. Can anyone help? cr _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
chuck remes