Re: deferred attach (Solaris 8)
- From: andrew@xxxxxxxxxxxxxxxxxxxx (Andrew Gabriel)
- Date: 02 Mar 2007 23:36:51 GMT
In article <1172746393.308142.110570@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
oaksoy@xxxxxxxxx writes:
Hi,
That would appear to contradict the attach(9E) manpage:
The attach(9E) function is called once for each instance of
the device on the system with cmd set to DDI_ATTACH. Until
attach(9E) succeeds, the only driver entry point which may
be called is getinfo(9E). See the Writing Device Drivers for
more information.
I have Solaris 8, and on the manpage for attach, it says
"... until attach(9E) succeeds, the only driver entry points which may
be called are open(9E) and getinfo(9E)."
If it can happen, I suspect it's because the attach and open can
be done by different threads, so the open can be called before the
attach has returned. However, the evidence is contradictory.
This is what I do not understand. The 'system' calls _init, and
_attach when it decides to load the driver, following an 'open' call
to this device. So there's only one thread in this situation.
That's not a safe assumption.
A bit of playing around with Dtrace in Solaris 10 shows that your
thread which calls open(2) is the thread which goes off to load
the driver, but isn't the thread which calls into any of the
driver functions, so that's being done by other thread(s) (at least
in the case of a STREAMS driver, and this is not unexpected as
threads in the STREAMS framework routinely pass work between each
other). Since I can't compile Dtrace fbt probes for a module which
isn't yet loaded, it's difficult to catch the thread which calls
the driver's attach(9E) function (would have to look into the
driver framework to find where it's called from, which I haven't
done).
In the case of an open(2) call when the module is already loaded,
then your thread which called open(2) actually calls the driver's
open function each time I tried it (although this probably won't
be guaranteed).
--
Andrew Gabriel
[email address is not usable -- followup in the newsgroup]
.
- References:
- Re: deferred attach (Solaris 8)
- From: oaksoy
- Re: deferred attach (Solaris 8)
- Prev by Date: Re: Issue with nohup logs after errors / exception(s)
- Next by Date: Solaris 9 tcpAttemptFails
- Previous by thread: Re: deferred attach (Solaris 8)
- Next by thread: cluster question
- Index(es):
Relevant Pages
|