Proper termination of an IOKit driver
Proper termination of an IOKit driver
- Subject: Proper termination of an IOKit driver
- From: "Brad Post \(MACBU\)" <email@hidden>
- Date: Tue, 30 Mar 2004 10:10:42 -0800
- Thread-topic: Proper termination of an IOKit driver
I am having problems with the unloading of an IOKit Driver and I need
some guidance as to the correct method to solve it.
The driver is based off the same code, so we only have the standard
functions: init, free, probe, start & stop
The problem we're running into is that the user can call kextunload on
our IOKit, which calls the stop method. Our code recognizes that the
application is still using the driver and fails, and we never call the
super::stop method. Unfortunately the IOServices removes our driver
from the IORegistry, and when the user then tries to reload the driver
with kextload bad things go amuck....
Forget the fact that this is an edge-case senario, and I know the minute
the user starts using kextunload, we don't really have to play nice, but
I want to play nice. We don't unload, which I thought was enough, but
now I have to figure out how to stop IOServices from removing us from
the IORegistry.
Is there a routine I need to be calling or some message I need to be
listening for? Sample code?
Thanks.
Brad
=3D=3D=3D=3D< my code snippet >=3D=3D=3D=3D=3D
void mykextclass::stop(IOService *provider)
{
kern_return_t result =3D KERN_SUCCESS;
IOLog("Stopping\n");
result =3D mydriver(provider);
if (result =3D=3D KERN_SUCCESS)
super::stop(provider);
}
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.