Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Problem with shutting down user clients
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with shutting down user clients



David --

When I invoke kextunload for my driver, my logging application detects a handshake error with one of its user-client instances and attempts to close all user-client connections (assuming that the driver is probably being unloaded).  The CloseUserClient() call for the last user client to be terminated, consistently returns a result of 0x10000003.

That error is MACH_SEND_INVALID_DEST. User clients use mach ports as forms of communication from user->kernel and some of the mach errors bleed through the API I believe. If you have subscribed for termination notifications (general interest + kIOMessageServiceIsTerminated), then you don't need to close the user client from the user space side; the connection is already broken.

  I haven't been able to find any reference that explains what this result code means.  Retrying the failed CloseUserClient() call doesn't seem to help.   CloseUserClient() calls for all user-client instances except the last have no problem.  As an experiment, I reversed the order in which I tried to close the instances, and it was still the last one I tried to close that failed.

kextunload fails, saying that there are outstanding instances for the user client and the driver.  When I check, I find one user-client instance and all of the driver instances.  I assume that the failure to unload the last user-client instance prevented unloading of any of the driver instances.

I have not completely characterized the problem at this point, but I'm making this early post in the hope the information I have will ring a bell with somebody and that I won't need to analyze further.

On the kernel side, you must be sure to detach() your user client from its provider (IOKit doesn't do this on your behalf). You may need to add code to your willTerminate()/didTerminate() sequence to ensure you properly close() your provider and detach() from it. Those things can cause extra retain's and cause objects to stick around...

HTH,

-- Chris


------------------

6 Infinite Loop

M/S 306-2MS

Cupertino CA 95014

phone: (408) 974-4033

fax:   (408) 862-7577

email: email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem with shutting down user clients (From: David Lee <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.