Krishna Yenduri wrote: > Folks, > > What is the documented/supported behavior for modunload(1M) when it is done > on a driver module? Does it guarantee that detach(9E) is called for all > attached device instances before _fini(9e) is called? >
Close, but not quite. What happens is when _fini is called, it arranges to call mod_remove(). mod_remove implicitly tries to detach all instances. If it fails to detach any of them, then it returns an error and _fini() error out as well. The DDI framework will not unload the driver in this case. (The error returned is probably EBUSY, IIRC.) I'm not sure if this amount of detail is documented or not, but huge amounts of code rely on it, and if Sun ever changed this behavior it would break pretty much every DR-safe driver in existence. Just to be clear, the callpath (with some middle bits elided) looks like: modunload(1M) --> via ioctl --> _fini() --> mod_remove(9F) --> (for each instance) xxx_detach(9e) -- Garrett > The detach(9E) man page implies that this is the case - > > If detach() determines a particular instance of the device > cannot be removed when requested because of some exceptional > condition, detach() must return DDI_FAILURE, which prevents > the particular device instance from being detached. This > also prevents the driver from being unloaded. > > > But, modunload(1M) man page is silent on this. > > Thanks, > -Krishna > > > This message posted from opensolaris.org > _______________________________________________ > driver-discuss mailing list > driver-discuss@opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/driver-discuss > -- Garrett D'Amore, Principal Software Engineer Tadpole Computer / Computing Technologies Division, General Dynamics C4 Systems http://www.tadpolecomputer.com/ Phone: 951 325-2134 Fax: 951 325-2191 _______________________________________________ driver-discuss mailing list driver-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/driver-discuss